From: Daniel Jacobowitz <drow@false.org>
To: Robert Dewar <dewar@adacore.com>
Cc: Nick Roberts <nickrob@snap.net.nz>,
Jan Kratochvil <jan.kratochvil@redhat.com>,
mathieu lacage <Mathieu.Lacage@sophia.inria.fr>,
gdb@sourceware.org
Subject: Re: [RFC] Signed/unsigned character arrays are not strings
Date: Tue, 27 Feb 2007 18:42:00 -0000 [thread overview]
Message-ID: <20070227131442.GA20718@caradoc.them.org> (raw)
In-Reply-To: <45E42969.1030007@adacore.com>
On Tue, Feb 27, 2007 at 07:51:53AM -0500, Robert Dewar wrote:
> Nick Roberts wrote:
>
> >That answers the question that we are really asking and justifies the
> >patch.
>
> Not necessarily. First it is only a claim, without documentation,
Do you have any reasonable ideas on how to gather data? I'm listening
:-)
I spent a little while poking at Google CodeSearch. There were
definitely some matches of people assigning strings to "unsigned char
*" variables - most of the ones I looked at were in test code for
crypto libraries, or things like base64 / locale ctype tables. There
were an order of magnitude (about 75x) more matches for plain "char
*".
signed\ char.*\ =\ .*\" about 7000
unsigned\ char.*\ =\ .*\" about 10600
char.*\ =\ .*\" about 753000
I know that as a GDB developer, debugging GDB, I'd want explicitly
signed or unsigned characters to be printed as data; we made a
deliberate switch to using gdb_byte (which is unsigned char) for
unknown data read from target memory. We cast it to char * when we
read strings.
> second, any incompatible change seems basically problematic.
I have some trouble understanding this. Could someone explain it to
me?
It's an honest and serious question, I'm not asking for a lecture on
compatibility concepts here. This is user interface, not core
functionality. It's more like clarifying the text of one of GCC's
warning messages than changing the dialect of C it accepts. I think
we have a lot of freedom to adapt our default output to be more useful
to our users, especially when we provide a way to get the old
behavior. In this case that method is even completely backwards
compatible.
I think we have a lot of freedom to make this kind of change. The
same reasoning applies to the print/x floating point discussion.
> > > We can document how to produce string output more
> > > clearly in the manual, perhaps?
>
> I would instead document more clearly how to produce the integer
> output.
Without this patch there wasn't any way to produce the integer output
for single byte elements. Which drove me batty working with vector
registers - I'm glad Jan posted the patch!
--
Daniel Jacobowitz
CodeSourcery
next prev parent reply other threads:[~2007-02-27 13:14 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-02-24 16:13 Nick Roberts
2007-02-24 20:11 ` Daniel Jacobowitz
2007-02-24 20:53 ` Nick Roberts
2007-02-24 21:07 ` Jan Kratochvil
2007-02-25 8:00 ` Daniel Jacobowitz
2007-02-25 19:54 ` Nick Roberts
2007-02-25 21:07 ` mathieu lacage
2007-02-26 0:45 ` Jan Kratochvil
2007-02-27 7:17 ` Eli Zaretskii
2007-02-27 9:29 ` Daniel Jacobowitz
2007-02-27 12:02 ` Nick Roberts
2007-02-27 17:06 ` Robert Dewar
2007-02-27 18:42 ` Daniel Jacobowitz [this message]
2007-02-27 21:53 ` Eli Zaretskii
2007-02-27 22:12 ` Daniel Jacobowitz
2007-02-27 22:14 ` Mark Kettenis
2007-02-28 0:47 ` Paul Koning
2007-02-28 1:14 ` Jim Blandy
2007-02-28 1:59 ` Jim Blandy
2007-02-28 5:26 ` Nick Roberts
2007-02-28 14:35 ` Daniel Jacobowitz
2007-03-01 0:43 ` Jim Blandy
2007-03-01 0:54 ` Nick Roberts
2007-02-27 21:47 ` Eli Zaretskii
2007-02-27 22:12 ` Daniel Jacobowitz
2007-04-10 21:59 ` Daniel Jacobowitz
2007-02-28 13:05 pkoning
2007-03-01 11:01 ` Mark Kettenis
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20070227131442.GA20718@caradoc.them.org \
--to=drow@false.org \
--cc=Mathieu.Lacage@sophia.inria.fr \
--cc=dewar@adacore.com \
--cc=gdb@sourceware.org \
--cc=jan.kratochvil@redhat.com \
--cc=nickrob@snap.net.nz \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox