From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25723 invoked by alias); 27 Feb 2007 22:12:12 -0000 Received: (qmail 25704 invoked by uid 22791); 27 Feb 2007 22:12:09 -0000 X-Spam-Check-By: sourceware.org Received: from sibelius.xs4all.nl (HELO brahms.sibelius.xs4all.nl) (82.92.89.47) by sourceware.org (qpsmtpd/0.31) with ESMTP; Tue, 27 Feb 2007 22:12:01 +0000 Received: from brahms.sibelius.xs4all.nl (kettenis@localhost.sibelius.xs4all.nl [127.0.0.1]) by brahms.sibelius.xs4all.nl (8.14.0/8.14.0) with ESMTP id l1RMBWVp022722; Tue, 27 Feb 2007 23:11:32 +0100 (CET) Received: (from kettenis@localhost) by brahms.sibelius.xs4all.nl (8.14.0/8.14.0/Submit) id l1RMBVvI028239; Tue, 27 Feb 2007 23:11:32 +0100 (CET) Date: Tue, 27 Feb 2007 22:14:00 -0000 Message-Id: <200702272211.l1RMBVvI028239@brahms.sibelius.xs4all.nl> From: Mark Kettenis To: drow@false.org CC: eliz@gnu.org, dewar@adacore.com, nickrob@snap.net.nz, jan.kratochvil@redhat.com, Mathieu.Lacage@sophia.inria.fr, gdb@sourceware.org In-reply-to: <20070227215316.GA26262@caradoc.them.org> (message from Daniel Jacobowitz on Tue, 27 Feb 2007 16:53:16 -0500) Subject: Re: [RFC] Signed/unsigned character arrays are not strings References: <17887.62990.937672.281975@kahikatea.snap.net.nz> <20070224161315.GA27534@caradoc.them.org> <17888.39894.136355.447008@kahikatea.snap.net.nz> <1172390381.2584.18.camel@mathieu> <20070225195350.GA12811@host0.dyn.jankratochvil.net> <20070226004457.GA9926@caradoc.them.org> <17892.4014.160191.285423@kahikatea.snap.net.nz> <45E42969.1030007@adacore.com> <20070227131442.GA20718@caradoc.them.org> <20070227215316.GA26262@caradoc.them.org> Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2007-02/txt/msg00285.txt.bz2 > Date: Tue, 27 Feb 2007 16:53:16 -0500 > From: Daniel Jacobowitz > > On Tue, Feb 27, 2007 at 11:06:17PM +0200, Eli Zaretskii wrote: > > Doesn't a similar situation exist with "unsigned int" and "int", or > > with "unsigned long" and "long"? And yet we don't treat them > > differently. > > > > IOW, I think it's quite expected that explicit signedness is > > relatively rare, since in the vast majority of cases it is simply not > > needed. Interpreting this phenomenon as saying something about what > > kind of data is stored is not necessarily a good idea. > > I feel that this is different for two reasons. One is that the > situation for int and long is not the same, because "int" and "signed > int" are the same type in C - but "char" and "signed char" are not. > Char is explicitly of indeterminate sign. The other is that there is > a widespread use of "char" for string data and "signed char" or > "unsigned char" for non-string data. Well, "char" really is "signed char" on most machines and "unsigned char" on others. One way to prevent the sign-extension problems this sometimes causes, is to explicitly use "unsigned char *" for strings. Anyway, I'm in favour of restore the traditional gdb behaviour of printing all three as strings. Mark