From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4293 invoked by alias); 1 Mar 2007 11:01:36 -0000 Received: (qmail 4282 invoked by uid 22791); 1 Mar 2007 11:01:34 -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; Thu, 01 Mar 2007 11:01:29 +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 l21AtoLO016442; Thu, 1 Mar 2007 11:55:50 +0100 (CET) Received: (from kettenis@localhost) by brahms.sibelius.xs4all.nl (8.14.0/8.14.0/Submit) id l21AtkMT024588; Thu, 1 Mar 2007 11:55:46 +0100 (CET) Date: Thu, 01 Mar 2007 11:01:00 -0000 Message-Id: <200703011055.l21AtkMT024588@brahms.sibelius.xs4all.nl> From: Mark Kettenis To: pkoning@equallogic.com CC: jimb@codesourcery.com, mark.kettenis@xs4all.nl, drow@false.org, 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: <86A3089001A44141B76B882059E7E53B01CCEED7@M31.equallogic.com> (pkoning@equallogic.com) Subject: Re: [RFC] Signed/unsigned character arrays are not strings References: <86A3089001A44141B76B882059E7E53B01CCEED7@M31.equallogic.com> 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-03/txt/msg00017.txt.bz2 > Date: Tue, 27 Feb 2007 20:51:54 -0500 > From: > > > Okay, here's a horrible idea. :) With this patch: > > > > $ cat chars.c > > #include > > #include > > > > typedef char byte_t; > > > > char *c = "chars"; > > unsigned char *uc = "unsigned chars"; > > signed char *sc = "signed chars"; > > byte_t *b = "bytes"; > > int8_t *i8 = "int8_t's"; > > uint8_t *ui8 = "uint8_t's"; > > Neat. > > I would tweak it a little. People might be using typedefs > for character strings that wrap, say, "unsigned char". > So if you're going to do a heuristic on the name, treat > it as a character string if the name ends in "char" (not > necessarily with a preceding space) or "char_t" (because > many people use _t as the suffix for typedef names). I think this is a bad idea. These choices are pretty arbitrary; isn't "string" a reasonable name for a character string typedef too. And then of course you'd need to add "string_t" too. Really, if we're going to have a list of types, I think it should be a list of types for which we are not going to print the result as a string. And it should only include typedefs mentioned in the relevant language standard. Oh and of course POSIX explicitly reserves the _t suffix, so people really should not be naming their types "char_t". Mark