On 10/30/2015 06:10 PM, DJ Delorie wrote:
$subject as far as I am aware these are the same on all supported targets.
The documentation for __CHAR_BIT__ says not to use it...
@item __CHAR_BIT__
Defined to the number of bits used in the representation of the
@code{char} data type. It exists to make the standard header given
numerical limits work correctly. You should not use
this macro directly; instead, include the appropriate headers.
I think that's for normal user code that's intended to be portable.
And the definition of BITS_PER_UNIT is more appropriate anyway:
@item BITS_PER_UNIT
The number of bits in an addressable storage unit (byte). If you do
not define this, the default is 8.
If a target had a sizeof(char) != 1, __CHAR_BIT__ and BITS_PER_UNIT
would be different, and IMHO BITS_PER_UNIT is the one we want to use
in the runtime, unless you're specifically talking about the "char"
type:
sizeof char is defined to be 1, so I think for libgcc code __CHAR_BIT__
is probably usable and appropriate.
Bernd