C++ Language/Type/Conversion/PromotingSmallIntegers

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

Often, there are no machine-language mathematical operators for integers smaller than int. Consequently, the compilation result of bTermA + bTermB where bTermA and bTermB are both unsigned char will "promote" both of these two terms into int before doing the addition.

Additional information about integer promotion (includes interactive examples)