sizeof(long long)

Svein E. Seldal Svein.Seldal@solidas.com
Tue Nov 19 07:51:00 GMT 2002


Hi,

Is it a strict requirement of C that "long long" is 64-bits? Or is it 
simply that sizeof(long long)>sizeof(long) (or maybe >=)?

In the AVR target, this the sizeof's are distributed as such: 
sizeof(char)=1, sizeof(short)=sizeof(int)=2, sizeof(long)=4, sizeof(long 
long)=8.

Since this is a small microcontroller, it has the -mint8 option, which 
does the following: sizeof(char)=sizeof(short)=sizeof(int)=1, 
sizeof(long)=2 and sizeof(long long)=8.

Note that there is a gap between long and long long. No 32-bits types 
exists for this mode -- this represents surely a problem when 32-bits 
types are wanted. My idead would then to decrease the long long size to 
be 32-bit.

I have a patch for it, but I wanted to make sure that this construct is 
valid..

Regards,
Svein



More information about the Gcc mailing list