This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Wide characters and GCC
Joseph S. Myers writes:
> On Mon, 11 Jun 2001, Michael Hayes wrote:
>
> > While chars are stored as 32-bits on the C4x there is an underlying
> > assumption that only the 8 LSBs are significant. Since sizeof(char)
> > = sizeof(short) = sizeof(int) on the C4x, you generally would use an
> > int type to store larger constants.
>
> ISO C says that all bits of unsigned char are significant. While C99
> allows signed char to have padding bits, ISO C++ doesn't. (Also, I doubt
> GCC really supports integer types with padding bits, even though
> c-tree.texi documents what TYPE_SIZE and TYPE_PRECISION are for them.)
OK, I chose the wrong word here. Yes, all the bits of an unsigned
char are significant on the C4x; you can perform 32-bit arithmetic
using chars if you wish. But if you wanted to write portable code you
wouldn't be doing this.
Michael.