Why are there differing definitions of INT64_MIN? And why do they behave differently?

三世轮回 提交于 2019-12-03 20:26:08

-9223372036854775808LL is not a single literal. It's an expression consisting of a unary - operator applied to the constant 9223372036854775808LL.

That constant is (barely) outside the range of type long long, which causes the warning.

The expression (-9223372036854775807LL -1), on the other hand, contains literals that are within the range of long long, and is an equally a more valid definition for INT64_MIN, since it's of the correct type (as Steve Jessop points out in a comment).

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!