Are long-suffix and unsigned-suffix needed when declaring long literals in C++?

前端 未结 4 2096
天命终不由人
天命终不由人 2021-01-07 01:22

I have some ancient memories of writing C code like:

long value = 0;

in the bad old Win16 days and ending up with value being

4条回答
  •  自闭症患者
    2021-01-07 02:13

    They are not required in the examples you gave. However, they may be needed in some somewhat recondite circumstances. For example, the following may produce different values:

    sizeof(1)
    sizeof(1L)
    

提交回复
热议问题