Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Mark Kettenis <mark.kettenis@xs4all.nl>
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
Subject: Re: [RFC] Signed/unsigned character arrays are not strings
Date: Thu, 01 Mar 2007 11:01:00 -0000	[thread overview]
Message-ID: <200703011055.l21AtkMT024588@brahms.sibelius.xs4all.nl> (raw)
In-Reply-To: <86A3089001A44141B76B882059E7E53B01CCEED7@M31.equallogic.com> 	(pkoning@equallogic.com)

> Date: Tue, 27 Feb 2007 20:51:54 -0500
> From: <pkoning@equallogic.com>
> 
> > Okay, here's a horrible idea.  :)  With this patch:
> > 
> > $ cat chars.c
> > #include <stdio.h>
> > #include <stdint.h>
> > 
> > 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


  reply	other threads:[~2007-03-01 11:01 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-02-28 13:05 pkoning
2007-03-01 11:01 ` Mark Kettenis [this message]
  -- strict thread matches above, loose matches on Subject: below --
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
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

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=200703011055.l21AtkMT024588@brahms.sibelius.xs4all.nl \
    --to=mark.kettenis@xs4all.nl \
    --cc=Mathieu.Lacage@sophia.inria.fr \
    --cc=dewar@adacore.com \
    --cc=drow@false.org \
    --cc=eliz@gnu.org \
    --cc=gdb@sourceware.org \
    --cc=jan.kratochvil@redhat.com \
    --cc=jimb@codesourcery.com \
    --cc=nickrob@snap.net.nz \
    --cc=pkoning@equallogic.com \
    /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