What is the difference between USHORT
and an unsigned short
and when would you use each?
USHORT is a macro which is not part of the official C++ language (it's probably defined or typedef'ed somewhere). unsigned short is an official type defined by the C++ language as an integer that can at least hold numbers between 0 and 65535.
Use unsigned short and your code will be portable - don't use USHORT unless you company's coding standard requires it.
unsigned short
is a standard C++ expression and USHORT is not. The precise definition can be found in the Wikipedia article Integer (computer science).
Sometimes, we typedef unsigned short USHORT in the header. Then USHORT can be used as well as unsigned short.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With