In message <lD**********************@news.xtra.co.nz>, Aaron Lawrence
<aa*******@HEREintegration.co.nz> writes
Hi all.
Suppose I have
bool CFoo::AMethod()
{
// do lots of side effects...
...
return false; // the only return
}
and later I have:
bool result = AMethod();
Is it OK for the compiler to skip the call to AMethod and just assign
the value false to result? Even if all optimisations are off?
Not if the side-effects affect program state. The compiler is allowed to
eliminate some calls to copy constructors, but otherwise the as-if rule
means that if the function has detectable side-effects, they must take
place.
Can you post a short complete program that demonstrates your actual
problem?
--
Richard Herring