Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2003-11-28 10:39:39


Beman Dawes wrote:
> At 10:58 AM 11/27/2003, Peter Dimov wrote:
>> These contain
>>
>> #if defined(_MSC_VER) && (_MSC_VER >= 1020)
>> # pragma once
>> #endif
>>
>> which is intentional. As a general rule, compilers that expose _MSC_VER
do
>> support "#pragma once".
>
> That's why I made the point in the original posting about comments
> indicating intent. It would be a lot easier if the above had said
> something like:
>
> #if defined(_MSC_VER) && (_MSC_VER >= 1020) // MS & compatible
> compilers
> # pragma once
> #endif

OK, I've added a comment.

> or maybe:
>
> BOOST_ONCE
>
> The BOOST_XXX macro approach seems preferable if it really is a
> commonplace usage (and thus something other compilers may add,
> perhaps with different spelling). Also would work well if Borland
> initially doesn't support #pragma once with their new compiler and
> then later does support it.

I'm not sure whether one can introduce a pragma with a macro, even if it
were possible, this requires a config.hpp dependency. #pragma once is only
used as an optimization in addition to the standard include guards. If I had
to include config.hpp I'd prefer to omit it entirely.

If Borland defines _MSC_VER but doesn't support #pragma once their users
will soon remind them that the Windows Platform SDK headers require it.


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