3 ms·
I don't know enough about C language and compiler technology to give a specific recommendation on that. However, your other comment on Java hints that its a hol
by nickpsecurity 11y ago
I don't know enough about C language and compiler technology to give a specific recommendation on that. However, your other comment on Java hints that its a hold-over from bad language design. Also, I recall that Fortran compilers could optimize the heck out of code that C compilers held back on specifically because Fortran was more deterministic. The compiler knew what the code was doing and could guess where usage was going. C's properties made the same code a giant unknown due to effects of pointers.
My overall point is that you can do an optimization from a set of statements with specific meaning at least as easy as you can from one with unknown meaning. So, a similarly low-level language with well-defined behavior could be optimized at least as much as C. However, since compiler faces uncertainty, the argument doesn't work the other way around. That's why C and its undefined behavior are bad by design.
And hence all the discussions on workarounds like the OP.