How to write an unsigned short int literal?

后端 未结 9 1443
慢半拍i
慢半拍i 2021-01-07 15:53

42 as unsigned int is well defined as \"42U\".

unsigned int foo = 42U; // yeah!

How can I write \"23\" so that it is clear it is an

9条回答
  •  轮回少年
    2021-01-07 16:50

    at least in Visual Studio (at least 2013 and newer) you can write

    23ui16
    

    for get an constant of type unsigned short.

    see definitions of INT8_MIN, INT8_MAX, INT16_MIN, INT16_MAX, etc. macros in stdint.h

    I don't know at the moment whether this is part of the standard C/C++

提交回复
热议问题