4 ms·
I guess the question is: will it silently optimize them away or will it be a compile error to use such expressions?
by d33 7y ago
I guess the question is: will it silently optimize them away or will it be a compile error to use such expressions?
- DerekL 7y agoIt can't be a compile error. It's not an error for a program to contain such code, it's only an error if that code executes.
- leni536 7y agoThat's not strictly true. Undefined behavior includes unsuccessful compilation as well [0]. But for this the compiler has to prove that the offending code is executed every time the program is executed. I think compilers don't bother with this though. [0] https://eel.is/c++draft/intro.defs#defns.undefined-sentence-3 https://eel.is/c++draft/intro.defs#defns.undefined-sentence-...