Re: [GD-General] meaning of sizeof(int) on all plateform
Brought to you by:
vexxed72
From: J C L. <cl...@ka...> - 2003-06-30 01:58:23
|
On Thu, 26 Jun 2003 15:12:48 -0700 Chris Jones <Jones> wrote: > This is all the standard has to say on the size of ints: "There are > four signed integer types: "signed char", "short int", "int", and > "long int." In this list, each type provides at least as much storage > as those preceding it in the list. Plain ints have the natural size > suggested by the architecture of the execution environment (1); the > other signed integer types are provided to meet special needs." Precisely. This is why on Crays there's a compilation environment where: sizeof(char) == sizeof(short) == sizeof(int) == sizeof(long) == sizeof(void*) == 1 Note also that ANSI doesn't require bytes to be 8bits. In the above case bytes are 64bits. > In other words, the result of sizeof(int) is never guaranteed to be of > a certain size. Although I believe the ISO C99 standard added new > header file, stdint.h, which declares some typedefs for specific sized > integer types. If only more compilers would follow the standards... Yeah. -- J C Lawrence ---------(*) Satan, oscillate my metallic sonatas. cl...@ka... He lived as a devil, eh? http://www.kanga.nu/~claw/ Evil is a name of a foeman, as I live. |