[Top][All Lists]

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

Re: Can g++ optimize empty function?

From: Andre Poenitz
Subject: Re: Can g++ optimize empty function?
Date: Thu, 7 Dec 2006 19:41:31 +0100

Paulo Matos <> wrote:
> Hi all,
> Can g++ optimize an (almost) empty function such as
> ostream& foo(ostream& o) { return o; }
> int main(void) {
>   foo(cerr);
>   return 0:
> }
> will g++ make the call to foo?

You could try g++ -O3 -S  on your code to see what the compiler
produces. And yes, there is no call to foo.


reply via email to

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