It's different viewpoints...
Posted May 24, 2011 7:00 UTC (Tue) by khim
In reply to: What Every C Programmer Should Know About Undefined Behavior #3/3
Parent article: What Every C Programmer Should Know About Undefined Behavior #3/3
Actually it's much simpler. Programmers usually assume that "undefined behavior" is some kind of "unknown behavior" and try to guess what's the worst case can be. Then they decide if they care or not.
Compiler, on the other hand, assume they work with C and/or C++ program. And proper C and/or C++ program never trigger undefined behavior. This means every time undefined behavior is detected by the compiler it can be assumed this part is never actually executed with arguments which can trigger undefined behavior - this makes it possible to build a lot of interesting theories which help optimization.
Note that ultimate conversion of all SSL functions to "return undef;" is valid optimization and it does not depend on CPU model at all.
to post comments)