[LLVMdev] optimization assumes malloc return is non-null
me22.ca at gmail.com
Fri May 2 13:23:50 CDT 2008
On Fri, May 2, 2008 at 2:07 PM, Sandro Magi <naasking at gmail.com> wrote:
> Sorry, clicked send by accident. It seems there's some background I'm
> missing though. Can I read up on this "as-if" rule anywhere?
>From the latest C++0x draft (n2588), 1.9/1 [intro.execution]:
"The semantic descriptions in this International Standard define a
parameterized nondeterministic abstract machine. This International
Standard places no requirement on the structure of conforming
implementations. In particular, they need not copy or emulate the
structure of the abstract machine. Rather, conforming implementations
are required to emulate (only) the observable behavior of the abstract
machine as explained below.*"
"* This provision is sometimes called the "as-if" rule, because an
implementation is free to disregard any requirement of this
International Standard as long as the result is as if the requirement
had been obeyed, as far as can be determined from the observable
behavior of the program. For instance, an actual implementation need
not evaluate part of an expression if it can deduce that its value is
not used and that no side effects affecting the observable behavior of
the program are produced."
(C++03 contains the same text)
I suppose the most important issue is what constitutes "observable behavior".
More information about the LLVMdev