small
int
). Otherwise, it's best to give yourself flexibility.However, types that merely wrap existing C types are not helpful:
typedef unsigned char UChar; // Bad usage
typedef
based on the function of the type, not its concrete representation. To help you with this, the header file PrimitiveTypes.h
contains useful definitions of primitive types. Two ANSI C header files, stddef.h
and limits.h
, contain definitions as well, here are two:
size_t
|
The type returned by the built-in C sizeof function. This is useful for representing the sizes of things.
|
ptrdiff_t
|
A type that can represent the difference between any two pointers. |
You might have noticed that these names don't conform to Taligent conventions. In the interest of clarity and portability, it is better to use the names as defined by ISO/ANSI C. However, a useful non-ISO/ANSI C type is void*
, which is for pointers to raw storage.
NOTE
If a data type is unsigned, declare it
unsigned
; this helps avoid nasty bugs down the road.
[Contents]
[Previous]
[Next]
Click the icon to mail questions or corrections about this material to Taligent personnel.