Re: [sigc] Implementatoin in .cc file



Brett Viren <bv bnl gov> writes:

> Martin Schulze writes:
>  > The problem is that I don't have a c++ book at hand. Could you
>  > please make clear whether in an optimized build gcc automatically
>  > marks member functions that are implemented in the class definition
>  > as inline? I.e. are the functions in slot_base and so on currently
>  > inline?
>
> g++(1) shows a switch to turn this off:
>
>        -fno-default-inline
>            Do not assume inline for functions defined inside a class scope.
>              Note that these functions will have linkage like inline func-
>            tions; they just won't be inlined by default.
>
> which implies that it is on by default.
>
Yes, but *only* in an optimized (-O[n], n >= 1) build. The default is
-O0 (although autofoo will try to pass -O2). Inlining does only happen
when optimization takes place.

>  > As a general rule I like having "one-line" functions inline and in
>  > the case of sigc++ also most short functions that get executed during
>  > signal emission and connection/disconnection of slots.
>
> Excessive use of inline can really suck if there is ever a need to
> trace through the code in the debugger.  I'd much rather have easy
> debugging than a few percent speed increase.
>  
Well, then compile with -O0 or without -O[n]. This can be decided by the
client of libsigc++, there is no need to consider "ease debugging"
vs. inlining for libsigc++ itself IMHO.

Andy
-- 
Andreas Rottmann         | Rotty ICQ      | 118634484 ICQ | a rottmann gmx at
http://yi.org/rotty      | GnuPG Key: http://yi.org/rotty/gpg.asc
Fingerprint              | DFB4 4EB4 78A4 5EEE 6219  F228 F92F CFC5 01FD 5B62

Latein ist das humanoide Äquivalent zu Fortran.
   -- Alexander Bartolich in at.linux



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