Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
为什么这段代码:
#include <iostream> int main () { int x = 1; int y = ~x; std::cout << y; }
总是打印 -(x+1)?如果 x = 00000001,不应该 y = 11111110 吗?
那是因为您使用的是二进制补码系统。C++ 不保证这一点,但所有(需要引用?)现代架构都具有此属性。