Re: inlining and squid-3

From: Robert Collins <robertc@dont-contact.us>
Date: 10 Jan 2003 08:31:41 +1100

On Thu, 2003-01-09 at 00:28, Robert Collins wrote:
> On Wed, 2003-01-08 at 08:05, Guido Serassio wrote:
>
> > This it should work without problems on the compile side, I'm not sure on
> > what happens on dependency side. Now I don't have time to make a test, but
> > it will try an experiment ASAP.
>
> Cool.
>
> I've put a sample into the fix_ranges branch (it didn't seem worth
> setting a new branch up for - it's trivial in most respects).

I've merged the configure.in logic into HEAD. Now you can add inline
source files whereever you want to.

The steps to add a inline source file are:
1) Add the .cci file to Makefile.am, in the noinst_HEADERS section. This
ensure it will be distributed.
2) Create the .cci file, being sure to include a copyright prelude.
3) In the class .h file, at the bottom, add
#ifdef _INLINE_
#include "class.cci"
#endif
4) in the class .cc file, at the bottom, add
#ifndef _INLINE_
#include "class.cci"
#endif
5) add the .cci file to CVS.
6) Done.

The steps to make a function or method inline with this are:
1) declare it as normal, but add _SQUID_INLINE_ to the definition.
as a function:
_SQUID_INLINE_ int FooBar();
or
class Foo {
// as a static method:
  _SQUID_INLINE_ static int Bar();
as a virtual method:
  _SQUID_INLINE_ virtual int tango();
as a plain method:
  _SQUID_INLINE_ int waltz();
};

2) Implement it with no decoration in the .cci file.
as a function:
int FooBar() {return 3;}
or method of some sort:
int Foo::tango() { return 5;}

This can even be done with operators.

Template classes, which always have to appear in headers, may be a
candidate for placing method bodies in an always used .cci file, but
that is a separate discussion.

Cheers,
Rob

-- 
GPG key available at: <http://users.bigpond.net.au/robertc/keys.txt>.

Received on Thu Jan 09 2003 - 14:31:46 MST

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:19:06 MST