Subject: Re: [boost] [function] function.hpp lacks include guard
From: Peter Bartlett (pete_at_[hidden])
Date: 2008-10-21 12:41:11
Quoting Niels Dekker - mail address until 2008-12-31
> 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
I haven't tested it, but looking at the code I think you can include
boost/function.hpp multiple times and if BOOST_FUNCTION_MAX_ARGS is
(re-)defined between any of those inclusions then everything still
works as you'd hope.
Boost list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk