Boost logo

Boost Users :

From: Miles Bader (miles.bader_at_[hidden])
Date: 2007-09-27 22:33:57


"Peng Yu" <pengyu.ut_at_[hidden]> writes:
> f1(i,d); // #1
> tie(i,d) = f2(); // #2
> ///////////////////
>
> What about the current commonly used compiler, such as GCC? Are #1 and
> #2 different in GCC?
>
> Does the compiler always have some way to optimize #2 to make it as
> good as #1? Is it just a matter of fact whether the optimization
> method is implemented?

I just tried it with gcc 4.2.1, and the tuple verison (#2) generates
(slightly) better code (because in the case of #2, it only has to push
one address to specify the "return location", instead of two separate
addresses required by #1).

-Miles

-- 
Do not taunt Happy Fun Ball.

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net