[Tutor] How to check the word size of the platform(OS)?

Alan Gauld alan.gauld at btinternet.com
Sat Aug 2 19:04:55 CEST 2014


On 02/08/14 14:02, Varuna Seneviratna wrote:
> What is the way to check the word size of the platform(OS), and also int
> size and character size, are they the same. I searched on line But
> couldn't get an answer


You need to give us more context.

Word size usually depends on CPU architecture.
It could be anything from 8 bit to 128 bit (and possibly more).

int size and char size depend on the compiler/interpreter.
For example in the TinyC compiler both int and char are 8 bits.
But several C++ compilers have settings/pragmas so you can
change the sizes within the limits of the target CPU.

If you are talking about Python (and this is, after all, a
Python list!) then int size is effectively unlimited.
char size depends on the Unicode encoding you choose. It
can be anything from 8 bits to 32 bits

What exactly do you need to know? How do you plan on using it?

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.flickr.com/photos/alangauldphotos



More information about the Tutor mailing list