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.
假设我有 2 个变量:
uint64_t a = ... uint32_t b = ...
比较整数会产生预期的结果,即(a != b)或(b > a)吗?
(a != b)
(b > a)
没问题。编译器在比较之前将 32 位提升为 64 位
简短的回答 - 是的。在比较之前,“较小”会转换为较大的。