Thread: Datatypes and processor/operating system architecture

  1. #1
    Banned
    Join Date
    Jan 2003
    Posts
    1,708

    Datatypes and processor/operating system architecture

    What is the maximum size of any datatype based on the processor/operating system? How does this change across MacOS, Linux, Windows 9.x, WindowsNT and MS DOS?

  2. #2
    Registered User
    Join Date
    Jan 2003
    Posts
    311
    It varies though of the above msdos is the only one I know were 16bit int's were popular. Even then, watcom, for example, had 32bit int's (and pointers though you had to use DPMI). <limits> and <limits.h>/<climits> are your only way to be sure.

  3. #3
    Just a Member ammar's Avatar
    Join Date
    Jun 2002
    Posts
    953
    Maybe you can use sizeof(dataType) where dataType could be int, double, float, etc...
    none...

  4. #4
    Registered User
    Join Date
    Jan 2003
    Posts
    648
    There is no limit to a size of a variable but speed is GREATLY decreses as size gets bigger or smaller than the cpu architecture size. On a 32-bit processor, 32-bit operations are faster than any other n-bit operations. That means that an int (or long int for those old compilers) will execute faster. On the newer Intel Itanium CPU series, which is 64-bits, longs will be faster.

    For the no limits: You can infinitly add using the 'adc' asm instruction on x86 processors (add and carry).

    However, on x86 and most other processors there are only 3 floating point sizes, 32 bits (float/single), 64 bits (double), 80 bits (long double (paragraph alligned)).

    A struct can be a data type; I'm guessing what you mean are primitives, or int, short, float, etc. If that's not what you mean, then there is no limit.

  5. #5
    pronounced 'fib' FillYourBrain's Avatar
    Join Date
    Aug 2002
    Posts
    2,297
    right, Win32 has an INT64 defined for instance. not supported by the architecture but there are ways around that. It's really just a matter of how clever you want to be with your math. if you have a large buffer that you want to use for a huge integer you could do lots of things to work with that.
    "You are stupid! You are stupid! Oh, and don't forget, you are STUPID!" - Dexter

Popular pages Recent additions subscribe to a feed