Thread: C++ Datatypes and OS Datatypes :: C++

  1. #1
    Registered User
    Join Date
    Nov 2001

    C++ Datatypes and OS Datatypes :: C++


    In general, is it more extensible to implement core C++ datatypes in 32bits and 64bits operating system, or should you implement the OS specific datatypes? For example, under Windows you can implement a DWORD (32bits unsigned integer). A DWORD is equal to C++ unsigned long.

    I would like to know what is most extensible in terms of C++ design and implementation?

    Lastly, what is the point of an int datatype in 32bits and 64bits OS? In 32bits OS, an int is equal to a long.


  2. #2
    It's full of stars adrianxw's Avatar
    Join Date
    Aug 2001
    I guess the answer really is dependent upon the question asker.

    Are you planning on using the same OS? If so, it would probably be a good idea to stick with the OS specific terms. If MS decide, at some point in time, to change the parameters to API calls, they could do so, and at the same time, redefine what the OS specific types were, thus your code would still compile.

    If you want inter OS portability/operability use the ANSI types, and accept that you'll need system specific maintenance strategies.

    >>> what is the point of an int datatype

    That is a question I have asked many times of C/C++ people. It always seems to cause problems. I came from a Fortran background, integers, (and most things), are declared as a type and a size, thus...

    INTEGER*1 8 bits
    INTEGER*2 16 bits
    INTEGER*4 32 bits
    INTEGER*8 64 bits

    ... and so on. Easy.
    Wave upon wave of demented avengers march cheerfully out of obscurity unto the dream.

Popular pages Recent additions subscribe to a feed