Quantcast
Viewing all articles
Browse latest Browse all 65

What optimizations does the strict aliasing rule facilitate?

This question is tangentially related to: Why is type reinterpretation considered highly problematic in many programming languages?

Regardless how 'problematic' type reinterpretation is, why do some languages such as C allow doing so through some avenues (memcpy, union) but not others such as pointer casts? A search reveals that the answer lies in 'optimization' but it remains unclear to me how to leaving the behavior constructs such as int x; float y = *(float *)&x; undefined permits optimizations that would not be possible if the behavior were defined the same way as if one used a union or memcpy().


Viewing all articles
Browse latest Browse all 65

Trending Articles