Trailing u in Hex Number C/C++

10,355

Appending u to any integral constant makes the compiler interpret it as unsigned.

Share:
10,355
ace
Author by

ace

Updated on July 18, 2022

Comments

  • ace
    ace almost 2 years

    Possible Duplicate:
    Meaning of U suffix

    I'm going through code that has a bunch of defines that look like: #define HEX_NUMBER (0x000000FFu)

    What is the trailing u? I've tried compiling with and without it and I don't see any difference.

  • Kerrek SB
    Kerrek SB over 12 years
    "interpret" is a bit misleading. What's happening is that the type of the literal expression is an unsigned type.