Metasize

C++ defines signed and unsigned variants of the types char, short, int, long, but does not define their sizes. Occasionally, knowing their sizes is useful -- or, more often, knowing which of them is a particular size is useful.

Here are three portable examples of how to use C and C++ type information to determine 8-, 16-, 32-, and 64-bit signed and unsigned types, if they exist. They rely upon the following guarantees of ISO C++:


Powered by PHP
Valid XHTML Valid CSS