Boost logo

Boost :

From: Chuck Allison (cda_at_[hidden])
Date: 2002-08-27 17:58:19


That's always been my favorite :-).

----- Original Message -----
From: "Greg Colvin" <Gregory.Colvin_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Tuesday, August 27, 2002 4:44 PM
Subject: Re: SV: [boost] #ifndef paradigm

> At 04:23 PM 8/27/2002, Henrik Ravn wrote:
> >> Often, when one wants to make sure a header is included only
> >> once, s/he uses
> >> the paradigm:
> >>
> >> #ifndef HEADER_NAME_H__
> >> #define HEADER_NAME_H__
> >>
> >> // code here...
> >>
> >> #endif // HEADER_NAME_H__ -- this comment is to make it clear
> >> what the endif
> >> is for
> >>
> >>
> >> It is better to remove the duality of the comment at the end,
> >> by switching
> >> to this paradigm:
> >>
> >>
> >> #ifndef HEADER_NAME_H__
> >>
> >> // code here...
> >>
> >> #define HEADER_NAME_H__
> >> #endif
> >
> >I would argue that the easiest idiom to use is this:
> >
> >#ifndef HEADER_NAME
> >#define HEADER_NAME
> >
> >// code here ...
> >
> >#endif // include guard
> >
> >in this way you don't have to update the header file both at the top and
> >the bottom in the infrequent event of a rename.
>
> And of course an even easier idiom is:
>
> #ifndef HEADER_NAME
> #define HEADER_NAME
> ...
> #endif
>
>
> _______________________________________________
> Unsubscribe & other changes:
http://lists.boost.org/mailman/listinfo.cgi/boost
>


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk