After a little google search (for instance, site:eel.is "as if rule"
) I couldn't find a proper place where the so called "as if" rule is clearly stated in the C++ standard. All I could find is that in those places within the standard where it is invoked, the intro.execution
reference is given.
But intro.execution
doen't seem to clearly reference any general form of this rule. I'm probably missing something subtle here, but can you point me to the place, or places, where a precise normative understanding of the rule is conveyed? Maybe the whole intro.execution
is indeed intended to convey what we call as the "as if" rule in the wild? I confess that I've just skimmed through it.
I'm using this website to navigate through the working draft of the standard.
The definition of the "as if" rule can be found, for instance in the cppreference site, as something to the effect that compilers are allowed to perform transformations on programs as long as some constraints are met, for optimizations reasons, for instance.