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 ビットにプロモートします。
簡単な答え - はい。「小さい」は比較前に大きいものに変換されます。