This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [RFC] a char* that doesn't alias everything
- From: "Joseph S. Myers" <jsm28 at cam dot ac dot uk>
- To: Dan Nicolaescu <dann at ics dot uci dot edu>
- Cc: <gcc-patches at gcc dot gnu dot org>
- Date: Mon, 28 Jan 2002 02:29:29 +0000 (GMT)
- Subject: Re: [RFC] a char* that doesn't alias everything
On Sun, 27 Jan 2002, Dan Nicolaescu wrote:
> Wouldn't it be useful to be able to assign string literals to
> int8_t*s ? Or use string functions on int8_t*s ?
That's clearly impossible. char is not a signed integer type or an
unsigned integer type; it is a special case which acts like one of signed
char and unsigned char but is compatible with neither. int8_t must be a
signed integer type. At present this type is signed char, but a type
without the aliasing properties of character types would be better.
> Basically if char* is not used to access things that are not chars,
> anything that is a char could be replaced by an int8_t (on platforms
> that chars are 8-bit).
> Wouldn't making them char and int8_t incompatible make this harder?
You'll need to use casts between them, but this is already the case.
(Though maybe some of the warnings in question only occur with -pedantic.)
--
Joseph S. Myers
jsm28@cam.ac.uk