In C and C++ code, use the AlTypes.h typedefs when referring to integral types. These typedefs provide an easy way to specify the word size of an integer variable in a cross-platform manner. The typedefs found in the AlTypes.h file provide definitions for the platforms most commonly used at A&L; when starting a project on a platform that's not yet represented in AlTypes.h, please provide definitions.
The types in AlTypes.h are:
Note that not all legacy or embedded platforms provide the underlying support for 64-bit data types.
A typical AlTypes.h looks like:
#ifndef h_AlTypes #define h_AlTypes #ifdef _WINDOWS // Microsoft Visual C++ Version typedef char SInt8; typedef unsigned char UInt8; typedef short SInt16; typedef unsigned short UInt16; typedef long SInt32; typedef unsigned long UInt32; typedef __int64 SInt64; typedef unsigned __int64 UInt64; #else // Macintosh version #ifndef __MACTYPES__ //typedef char SInt8; typedef unsigned char UInt8; typedef short SInt16; typedef unsigned short UInt16; typedef long SInt32; typedef unsigned long UInt32; typedef long long SInt64; typedef unsigned long long UInt64; #endif #endif #endif /* This must be the final line in this file. */
Each project should make modifications as appropriate for the platform and compiler in use.