Some major C projects violate the strict aliasing rules in the C standard and must be compiled with -fno-strict-aliasing. These include Python, OCaml and the Linux kernel.

Obviously this is not ideal. However, it seems hard to avoid in many cases, especially language runtime systems where rampant aliasing is the reality. Is this acceptable programming practice?

  • It can be hard to avoid aliasing as a way to avoid copying messages around in protocol code. Plus what you can and can't do in strict aliasing is not well understood. Still the code you cite has been around a while. I would avoid creating new projects with strict aliasing disabled.
    – Doug T.
    Commented Oct 7, 2015 at 11:44


Browse other questions tagged or ask your own question.