On Sat, 15 Oct 2011, ben wrote:
However, the
standard also requires that the character type occupy at
least 8 bits, that the minimum range for unsigned char is 0 to 255, and
that the minimum range for signed char is -127 to +127 (section 5.2.4.2.1).
How ever this is under C triva, not the latest standard of the year.
So what does the C-bible say on this?
I don't know from no "bible".
First edition of K&R explicitly stated that the sizes are NOT fixed, that
"int" is whatever size is most practical to implement for the compiler,
and that the ONLY given is that "char" must not be a LARGER data type than
"int", and that "long" must not be a SMALLER data type than
"int".
It was quite common for "int" to be signed 16 bit, with "char" being 8
bit
(although either signed or unsigned), and "long" was usually signed 32
bit. But K&R explicitly said not to EXPECT that.
FAT16, for example used a SIGNED long for both the file size and for the
maximum partition size. Therefore, instead of 0 to 4GB, the range was
-2GB to +2GB
That opens up some interesting possibilities!
I stepped on the DIR of a floppy disk, and created a -2GB file. I then
copied that file to an almost full hard disk, in order to get more disk
space without the DANGERS! of compression. It didn't work.
--
Grumpy Ol' Fred cisin at
xenosoft.com