Karl F. Larsen wrote:
>
> I have recieved many responses to my first message all saying it
> is proper for an int to have 4 bytes. So I went back to the original
> function that checks int, float, long and char. My GCC sizeof() says all
> these types use 4 byte! This just proves more fully that sizeof() is
> broken in my Linux. Here is the test program.
>
> /* prints out type sizes */
> #include <stdio.h>
> int main(void)
> {
> printf("Type int has a size of %d bytes.\n", sizeof(int));
> printf("Type long has a size of %d bytes.\n", sizeof(long));
> printf("Type float has a size of %d bytes.\n", sizeof(float));
> printf("Type char has a size of %d bytes.\n", sizeof(char));
> return 0;
> }
Then *your* version of gcc is broken. On my system (Intel, gcc-2.8.1),
this program prints:
Type int has a size of 4 bytes.
Type long has a size of 4 bytes.
Type float has a size of 4 bytes.
Type char has a size of 1 bytes.
which is correct.
--
Glynn Clements <[EMAIL PROTECTED]>