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: [RFC] Signed/unsigned character arrays are not strings


> 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).

	paul


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