C interpretation of hexadecimal long integer literal “L”

后端 未结 2 1882
-上瘾入骨i
-上瘾入骨i 2021-01-25 16:06

How does a C compiler interpret the \"L\" which denotes a long integer literal, in light of automatic conversion? The following code, when run on a 32-bit platform (32-bit long

2条回答
  •  天命终不由人
    2021-01-25 17:03

    The thing is that the rules of determining the type of the integral literal are different depending on whether you have a decimal number or a hexadecimal(or octal number). A decimal literal is always signed unless postfixes with U. A hexadecimal or octal literal can also be unsigned if the signed type can not contain the value.

提交回复
热议问题