This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: 'char **' <-> 'unsigned char **' and aliasing/punning in C / GNU C
Hello,
FYI, I got word back from Joseph Meyers on a separate
channel, and his answer was:
It's not valid. char and unsigned char can alias, but
not char * and unsigned char *.
Regarding char * and const char *, I then asked:
Can char * and const char * alias?
He said:
Not in C (but they can in C++, where you can implicitly convert from char
** to const char *const *, although not from char ** to const char **).
We're going to avoid these casts in GDB then, and do instead
things like:
gdb_byte *buf;
char *c;
...
bufsiz = target_read_alloc (¤t_target, TARGET_OBJECT_AVR,
"avr.io_reg", &buf);
c = (char *) buf;
Thanks a lot,
--
Pedro Alves