Any comment on this?
On Wed, 2002-10-30 at 23:05, Robert Collins wrote:
> We will likely want to inline many of the trivial methods in squid-3
> objects.
>
> Does extern_inline exist for all C++ compilers? I've a suggestion for
> inlining that doesn't use extern_inline, but can be trivially modified
> to do so if desired:
>
> Firstly, this is aimed at allowing development to use non inlined code
> for speeding up the devel cycle, but to switch that over to explicitly
> inlined when building distribution binaries. So per-module inlining
> isn't needed for this approach. It can be incrementally brought in by an
> extra level of control (if (global inlining) define (local inlining)) if
> desired.
>
> Approach:
> Define two macros for the CXX and C flags (I'll do up configure magic
> for this if we agree on the approach):
> -D_SQUID_INLINE_=inline -D_USE_INLINE_
> this enables inlining.
> We define
> -D_SQUID_INLINE_=
> if we are not inlining.
>
> Then, in class definitions, we can mark candidate inlined methods
> thusly:
> class Foo {
> public:
> _SQUID_INLINE_ void someMethod();
> };
>
> Now, we create a new file:
> Foo.cci (cc inline)
> which complements Foo.cc and Foo.h and includes the inlined methods.
>
> At the end of Foo.cc we do:
> #ifndef _USE_INLINE_
> #include "Foo.cci"
> #endif
>
> At the end of Foo.h we do:
> #ifdef _USE_INLINE_
> #include "Foo.cci"
> #endif
>
> within Foo.cci, method implementations are done as normal:
> void
> Foo:somemethod()
> {
> }
>
> This allows us to:
> * Code methods that may be inlined once, without maintaining two copies.
> * Switch easily between inlined and non inlined code bases for
> production (inlined) and development (non inlined)
>
> What do you think?
>
> Rob
-- GPG key available at: <http://users.bigpond.net.au/robertc/keys.txt>.
This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:19:06 MST