RE: [Doxygen-users] (no subject)
Brought to you by:
dimitri
|
From: Kris T. <kri...@cs...> - 2002-01-16 16:37:22
|
>
> Here is one solution, all the following is in the
> header file -
>
> ------------------------------
> class A
> {
> public:
> int method1 ();
> void method2 ();
> };
>
> /**
> * Blah
> * @return blah
> */
> int A::method1 () const {return simple_thing;}
>
> /**
> * Blah2
> */
> void A::method2 () {do_something_simple ();}
> --------------------------------
>
> But I have a question about inlining - will some
> compilers fail to inline methods because the
> definition is now separate from the declaration?
You HAVE to say
class A
{
public:
int method1 ();
void method2 ();
};
Otherwise the compiler won't know you want to inline, and it will generate a
A::method1 implementation in every object file whose source happens to
include your header (think about what #include does and it will make sense).
This will give you lots of linking problems.
Aside from that, personally, I prefer my documentation in the class
definition, while I put the inline implementations somewhere else. In that
way, people reading the source only have to check the class definition and
nothing else.
(I put the inlines in a spearate file blabla.inl to stress that fact). But
that's up to you of course.
All the best,
Kris Thielemans
Imaging Research Solutions Ltd
Cyclotron Building
Hammersmith Hospital
Du Cane Road
London W12 ONN, United Kingdom
web site address:
http://www.irsl.org/~kris
|