This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC 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: BITS_PER_UNIT less than 8


On Fri, 7 Dec 2007, Ross Ridge wrote:

> Boris Boesler writes:
> > Ok, so what have I to do to write a back-end where all addresses are
> > given in bits? Memory is addressed in bits, not bytes. So I set:
> >
> > #define BITS_PER_UNIT 1
> > #define UNITS_PER_WORD 32
> 
> I don't know if it's useful to define the size of a byte to be less than
> 8-bits, even if that more accurately reflects the hardware.  Standard C
> requires that the char type both be at least 8 bits (UCHAR_MAX >= 256)
> and the same size as a byte (sizeof(char) == 1).  You can't define any
> types that are smaller than a char and have sizeof work correctly.

In theory GCC supports CHAR_TYPE_SIZE > BITS_PER_UNIT, so sizeof(char) is 
still 1 (sizeof counts in units of CHAR_TYPE_SIZE not BITS_PER_UNIT) but a 
char is not the hardware addressing unit.  I expect this is even more 
broken in practice than BITS_PER_UNIT > 8.

-- 
Joseph S. Myers
joseph@codesourcery.com


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