help-gplusplus
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

About g++ optimization


From: address@hidden
Subject: About g++ optimization
Date: 30 Mar 2006 12:30:30 -0800
User-agent: G2/0.2

for(int i = 0; i < f(n); ++ i) {
...
}

If I have the above "for" statement and I compile it with -O3, will the
function "f(n)" be optimized such that f(n) will only be evaluated
once. Or I have to factor "f(n)" outside the loop to make sure that it
only be evaluated once?

Thanks,
Peng



reply via email to

[Prev in Thread] Current Thread [Next in Thread]