[Wolves] Text size

sparkes sparkes at phreaker.net
Fri Apr 30 17:53:53 BST 2004


On Fri, 2004-04-30 at 14:42, C J Coleman wrote:

> 
> ASCII is actually 7-bits, but I think it may be stored as one byte.
> The C 'char' primitive is one byte, with the positive values of a
> 'signed char' being ASCII.  Hope that helps,

I hate to be pedantic but a C char shouldn't considered to be any fixed
bit size all things being relative char is only normally a short int. 
The only thing you can be sure of is that sizeof(char) will return 1
whatever *real* size it has because the specification says it should. 
Short will be at least 16 bits and sizeof(short) might be 2, long will
be at least 32 bits and int will be no shorter than short and no longer
than long ;-)

So on your 32 bit intel machine sizeof(int) and sizeof(long) will
probably both return 4.

Because int is normally the natural word size of the machine, and your
intel hardware is 32 bit which if you don't look at the odd examples
should be right but probably isn't. 16, 32 and 64 bits are common with
128 bit specalist processors becoming common (your graphics card might
use 128bit processors and local buses), 24 and 36 very, very rare but if
they can exist then anything can in the future ;-)

Some machines also need their data lined up in the memory so char,
short, int and long might all be the natural wordsize (and multiples
thereof) on such hardware.

Normally if you only write code that actully cares about bit sizes when
you are writing device drivers and then you will probably use a bit
field and a bunch of ints in a union so you can address the bits on
their own as well as a word at a time.

but you are right that ascii is 7bit clean the extra bit does the
extended IBM graphic bits on lots of hardware.

sparkes




More information about the Wolves mailing list