> I am learning to write C and yesterday tried to write a program
> that used sizeof() and it is broken in my version of compiler. No matter
> what kind of variable, the Linux sizeof() returns 4. I went back to my old
> Borland DOS compiler and it works there.
...
> This prints 4 in Linux and 2 (which is correct) using Borland C++.
Nope, you are assuming that old 16 bit DOS setup is the "correct"
way to do things.
The C specification says basically that following relations
should hold true:
sizeof(char) <= sizeof(short) <= sizeof(int) <= sizeof(long)
16-bit 8086, PDP-11:
8, 16, 16, 32
32-bit 80386 (UNIX mode):
8, 16, 32, 32
64-bit Alpha (UNIX mode):
8, 16, 32, 64
CRAY:
64, 64, 64, 64
This last one is in fact what troubles Samba folks when they
try to get the server to work at CRAY UNICOS...
...
> Best wishes
> - Karl F. Larsen, 3310 East Street, Las Cruces,NM (505) 524-3303 -
/Matti Aarnio <[EMAIL PROTECTED]>