Boost logo

Boost :

From: Beman Dawes (bdawes_at_[hidden])
Date: 2003-11-28 09:26:55


At 10:58 AM 11/27/2003, Peter Dimov wrote:
>Beman Dawes wrote:
>>
>> Is this something we want to try to fix this release? There is
>> possibly suspect _MSC_VER use in the Boost headers listed below.
>>
>> --Beman
>>
>> boost\bind.hpp
>> boost\checked_delete.hpp
>> boost\current_function.hpp
>> boost\mem_fn.hpp
>> boost\ref.hpp
>> boost\throw_exception.hpp
>> boost\bind\arg.hpp
>> boost\bind\placeholders.hpp
>> boost\detail\atomic_count.hpp
>> boost\detail\atomic_count_win32.hpp
>> boost\detail\lightweight_mutex.hpp
>> boost\detail\lightweight_test.hpp
>> boost\detail\lwm_nop.hpp
>> boost\detail\lwm_pthreads.hpp
>> boost\detail\lwm_win32.hpp
>> boost\detail\lwm_win32_cs.hpp
>> boost\detail\lwm_win32_nt.hpp
>> boost\detail\quick_allocator.hpp
>> boost\detail\shared_count.hpp
>
>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

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.

But even just adding a comment makes clear to a "grep" that the case of
compatible compilers was considered.

--Beman


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