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.
-fpermissiveGCC 4.6 (with ) で正常にコンパイルされる一部のレガシー コードでは、次のようになります。
-fpermissive
uint16_t a = 0; void* b = ...; if(b == a) // ...
この比較は GCC 4.6 で明確に定義されていますか? 16 ビットにダウンキャストするか、32/64 ビットにアップキャストしますか?
ポインタのサイズに合わせて 16 ビット整数をアップキャストしているようです。次のコード出力を実行する"upcast"
"upcast"
uint16_t a = 1; void* b = (void*)0x10001; (b == a) ? printf("downcast") : printf("upcast");