Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

while vs for

Name: Anonymous 2010-07-02 13:41

Whats the difference?

Name: Anonymous 2010-07-03 1:30

>>24
if the compiler can determine that checking the condition has no side effects and the condition cannot possibly change, it doesn't have to check it on every pass. if the condition is a compile-time constant, it doesn't have to check it at all. the standard only guarantees that it will be checked on every pass if checking the condition has side effects or the condition can change.

Name: Anonymous 2010-07-03 1:40

>>24
C99 5.1.2.3p3: In the abstract machine, all expressions are evaluated as specified by the semantics. An actual implementation need not evaluate part of an expression if it can deduce that its value is not used and that no needed side effects are produced (including any caused by calling a function or accessing a volatile object).

This idea is informally called the "as if" rule.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List