[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: About g++ optimization
From: |
Allan Wind |
Subject: |
Re: About g++ optimization |
Date: |
Thu, 30 Mar 2006 17:01:43 -0500 |
User-agent: |
Mutt/1.5.9i |
On 2006-03-30T12:30:30-0800, PengYu.UT@gmail.com wrote:
> for(int i = 0; i < f(n); ++ i) {
> ...
> }
Make sure you remove the space between ++ and 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?
If you compile you example with -S then the assembler file (.s) will
tell you.
/Allan
signature.asc
Description: Digital signature
- About g++ optimization, address@hidden, 2006/03/30
- Re: About g++ optimization,
Allan Wind <=
- Message not available