This is the mail archive of the gdb@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: MI failures related to string printing


On Fri, Jan 12, 2007 at 12:18:44PM +0100, Mark Kettenis wrote:
> I think the whole idea of doing string comparisons for C (or C++)
> "char *" pointers is flawed.  There is no guarantee that a "char *"
> actually points to a null-terminated as the test shows.  You should
> not treat "char *" any different from other pointers like "int *", at
> least not by default.  You could implement a way for the user to
> specify that a "char *" is actually a pointer to a string instead of a
> single character.  But otherwise I think the string comparison should
> only do for languages that have a genuine string type, such as Pascal.

GDB handles char*'s specially in the print command. There is an option
to tell it that the string shouldn't be displayed as null-terminated.

I think it's appropriate to handle the char* special as long as there is
an option not to do so.

Bob Rossi


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]