Re: inlining and squid-3

From: Guido Serassio <serassio@dont-contact.us>
Date: Sun, 12 Jan 2003 09:50:46 +0100

Hi Robert,

Il 10:31 PM 1/9/2003 Robert Collins ha scritto:
>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
>--

I have just made a test with Visual Studio:

- On dependency side, all is OK
- On build method side (C, C++, etc), it seems that the .cci file inherits
the parent file settings, so it should be OK.
- On editing side, there is the same problem of .cc files: they aren't
recognized as C/C++ sources. So I have added the cci extension to Visual
Studio with the same registry file used to add the .cc extension
(.\port\win32\VisualStudio6.0.reg). After this it's OK.

So it seems that it works fine.

Regards

Guido

-
=======================================================
Serassio Guido
Via Albenga, 11/4 10134 - Torino - ITALY
E-mail: guido.serassio@serassio.it
WWW: http://www.serassio.it
Received on Sun Jan 12 2003 - 01:51:33 MST

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