Variables of type int are supposedly "one word of a machine type in length" but in embedded systems, C compilers for 8-bit microconsumption have int 16 bits !, (8 bits for unsigned char), then for more bits int behaves normally: in 16- bit int microns are also 16 bits, and 32 bit int microns - 32 bits, etc.
So, is there a standard way to test it, something like BITSIZEOF (int)?
like "sizeof" for bytes, but for bits.
That was my first idea.
register c=1;
int bitwidth=0;
do
{
bitwidth++;
}while(c<<=1);
printf("Register bit width is : %d",bitwidth);
c int, 8- , int 16 , 16 . , "int" " ", ( )
? , , 256 , 8, 16, 32 , ( , ) , ,
http://embeddedgurus.com/stack-overflow/category/efficient-cc/page/4/
( )
, - . , , C99 "" "". C99, , - . , , , .