This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: [commit] Ada-valprint.c const tweaks
Date: Fri, 28 Jan 2005 15:24:28 -0500
From: Andrew Cagney <cagney@gnu.org>
Mark Kettenis wrote:
> Date: Fri, 28 Jan 2005 14:19:48 -0500
> From: Andrew Cagney <cagney@gnu.org>
>
> FYI,
> Andrew
>
> This patch must be wrong! In C a string has type 'char *' and the
> type of a single character is 'int'. If your compiler is warning
> about incompatible types here, it's got a bug. This proves that
> mindless replacement of 'char' with 'bfd_byte' is a stupid thing to
> do.
I've attached exibit A, the full patch that I'm merging.
If you look carefully at printstr, you'll see that it's receiving in raw
byte buffer _buffer_ and a _length_; not a null terminated "char *"
string. That language code, such as scheme, print it using %s is well
"somebody elses problem".
Ah I see. The code in c-lang.c:c_printstr() is extracting bytes as
integers. So sorry, yes you're right. I still think we should use
'void *' instead of 'bfd_byte *' though.
Mark