[egcs-1.0.1/i586-pc-linux-gnulibc1] g++ and inline
Andrew Pollard
andrew@odie.demon.co.uk
Fri Jan 9 04:20:00 GMT 1998
This isn't a bug report, just a great improvement over gcc-2.7.2 :-)
a.cc:
-------------------------------------------------------------------------------
struct A {
int a;
A(int _a) : a(_a) {}
int foo(void) const { return(bar()); }
int bar(void) const { return(a); }
};
-------------------------------------------------------------------------------
% g++ -v
Reading specs from /usr/lib/gcc-lib/i586-pc-linux-gnulibc1/egcs-2.90.23/specs
gcc version egcs-2.90.23 980102 (egcs-1.0.1 release)
% g++ -O -finline-functions -Winline a.cc
a.cc: In method `int A::foo() const':
a.cc:6: warning: can't inline call to `int A::bar() const'
a.cc:5: warning: called from here
gcc-2.7.2.2 didn't warn about this (and didn't inline the code
either).
(ie you have to declare inline functions before they are used in other
inline functions).
Good stuff...
Andrew.
--
Andrew Pollard, Auto Simulations Ltd. UK. | home: andrew@odie.demon.co.uk
2 Milbanke Court, Milbanke Way, Bracknell | work: andrewp@autosim.com
Tel:+44(0)1344 426486x103 Fax:+44(0)1344 426615 | http://www.odie.demon.co.uk
More information about the Gcc
mailing list