Boost logo

Boost :

Subject: Re: [boost] [function] function.hpp lacks include guard
From: Niels Dekker - mail address until 2008-12-31 (nd_mail_address_valid_until_2008-12-31_at_[hidden])
Date: 2008-10-21 12:33:45


Okko Willeboordse wrote:
> My co-worker Bob Praster found, using PC-Lint 9.0, that
> function.hpp doesn't have an include guard like;

Mathias Gaunard wrote:
> That's most likely because it doesn't need one, since it's
> only including other headers.

If so, it's probably just a matter of taste. Personally I always add
those include guards to my headers, even when they're not strictly
needed. Once in a while I might have to look into the preprocessor
output, because of some buggy macro call of mine. In that case, I
appreciate having each header included only once, to reduce the amount
of noise in the preprocessor output file.

> #ifndef BOOST_FUNCTION_HPP
> #define BOOST_FUNCTION_HPP
> ...
> #endif // BOOST_FUNCTION_HPP

Is it allowed to have an #endif followed by comment, on the very same
line?

Kind regards,

--
Niels Dekker
http://www.xs4all.nl/~nd/dekkerware
Scientific programmer at LKEB, Leiden University Medical Center 

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