Mail Archives: djgpp/1997/08/13/09:23:44
Erik Max Francis wrote:
>As the chief ANSI C advocate on this newsgroup, I should point out that
>ANSI does not say anything about the size of the fundamental integer types
>(short, int, long), except that short is no larger than int and int is no
>larger than long, and short is at least 16 bits and long is at least 32.
>(What's interesting is that these latter two requirements are hidden
>rather well in the standard.)
I have used one compiler (VAX, possibly?) which had short = int = long
and
all 32 bit. Fortunately, char was still 8 bit (but it needn't be - some
machines have 9 bit chars).
The only portable way is to do it yourself - either by breaking longer
variables up into chars or in ASCII. Especially since you can't rely
on any byte ordering scheme (I gather there are some machines where a
long is held in memory as bytes 2, 1, 4 and 3 or something similar, not
even a reversible format).
Isn't this all in the FAQ? Or was it one of the other C newsgroup FAQs?
Chris C
- Raw text -