Safe assumptions

There are few safe assumptions that you can make about raw C and C++ data types, and these are all you can safely assume:

    Always read and write an int by casting it to a short, because that's all you're guaranteed to get.
    The Taligent stream
    classes do not read or write int because int doesn't have a portable representation.
If you need exact information about a raw data type, use the symbols defined in limits.h and float.h. However, remember that the values of these symbols can change from processor to processor or compiler to compiler, within the limits defined above (for more information, see the ANSI/ISO C specification).

In general, watch your assumptions carefully, and use typedefs instead of C types. For examples, see "Avoid raw C types with dimensions" on page 66.

[Contents] [Previous] [Next]
Click the icon to mail questions or corrections about this material to Taligent personnel.
Copyright©1995 Taligent,Inc. All rights reserved.

Generated with WebMaker