|
Boost : |
From: Beman Dawes (bdawes_at_[hidden])
Date: 2001-07-03 15:25:05
At 12:50 PM 7/3/2001, David Abrahams wrote:
>
>----- Original Message -----
>From: "Jeff Paquette" <paquette_at_[hidden]>
>
>> Include guards can and are also used to prevent the header from being
>> reparsed (as suggested by Lakos). As such, it (IMHO) would be better if
>the
>> guard referenced the file name.
>>
>> I'd rather write:
>>
>> #if !defined(BOOST_XXX)
>> #include "boost/xxx"
>> #endif
>>
>> than
>>
>> #if !defined("68C2D2A0-6FD1-11d5-8F0C-00105AC8B6E1")
>> #include "boost/xxx"
>> #endif
>
>This practice is unreliable with most headers. For example, you can't do
>that with your system headers if you're writing portable code. Most
>standard
>and 3rd party libraries don't document their #include guard conventions,
so
>you have to look inside the header to determine what guard they used --
and
>there's no guarantee they won't change it.
>
>We could of course establish such a convention with boost headers, but I
am
>unconvinced of the benefits.
No, I don't think we want to encourage such flaky code.
It is OK for a small, tightly controlled project to rely on specific
#include guard conventions, but for diverse project like Boost, we don't
want to become dependent on a set of include conventions.
--Beman
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk