help-gplusplus
[Top][All Lists]
Advanced

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

Can g++ optimize empty function?


From: Paulo Matos
Subject: Can g++ optimize empty function?
Date: 7 Dec 2006 08:05:32 -0800
User-agent: G2/1.0

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?

Problem is I'm strugling to find a way to insert debugging info without
messing around with Macros too much. So I would define foo with a body
if DEBUG is defined during compile time and remove the body if DEBUG is
not defined. However, one of my priorities is not to have debugging
code during release builds since this is a batch application and a lot
of debugging output will surely delay it a lot!

Suggestions would be great!

Regards,

Paulo Matos



reply via email to

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