C++ Language/Type/HungarianPrefixes

From Wikibooks, open books for an open world
Jump to navigation Jump to search

C++'s signed integer types are signed char, short, int, and long long. On Win32, the sizes of those are 1, 2, 4, and 8 bytes (respectively), but that might be different on other platforms. Each of those types has an unsigned version (e.g., unsigned int instead of int).

C++'s floating-point types are float and double. On Win32, the sizes of those are 4 and 8 bytes (respectively).

A popular programming practice is to name your variables using a "Hungarian prefix", where its name's first few letters is an encoding of that type (e.g., variable fVar has type float), but the language makes no such requirement.

Additional information about Hungarian prefixes (includes interactive examples)