Does this union break strict aliasing? What about floating point registers

前端 未结 2 379
感情败类
感情败类 2021-01-21 14:34
union
{
    Uint32 Integer;
    Float32 Real;
} Field;    

I have to use that union for a little IEEE trick, does that break strict aliasing? GCC is no

2条回答
  •  一个人的身影
    2021-01-21 15:19

    It is UB (but doesn't require strict aliasing). Also, uniond data is always stored in memory by implementations, AFAIK, else would require knowing which register the source data came from, which means knowing the source type.

提交回复
热议问题