Quantcast
Channel: User CPlus - Programming Language Design and Implementation Stack Exchange
Viewing all articles
Browse latest Browse all 66

What optimizations does the strict aliasing rule facilitate?

$
0
0

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 66

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>