|
|
If you truly need control over exact type sizes, this is the right approach.There remain several things to be aware of:
- There might not be an exact match on some machines. (There are, for example, 36-bit machines.)
- A typedef like int16 or int32 accomplishes nothing if its intended meaning is ``at least'' the specified size, because types int and long are already essentially defined as being ``at least 16 bits'' and ``at least 32 bits,'' respectively.
- Typedefs will never do anything about byte order problems (e.g. if you're trying to interchange data or conform to externally-imposed storage layouts).
- You no longer have to define your own typedefs, because the Standard header <inttypes.h> contains a complete set.
See also questions 10.16 and 20.5. |
|