|
Boost : |
From: Edward Diener (eldiener_at_[hidden])
Date: 2021-02-25 22:48:48
On 2/25/2021 5:22 PM, Edward Diener via Boost wrote:
> On 2/25/2021 5:04 PM, Andrey Semashev via Boost wrote:
>> On 2/26/21 12:15 AM, Robert Ramey via Boost wrote:
>>> On 2/25/21 12:48 PM, Gavin Lambert via Boost wrote:
>>>
>>>> Conditioning a boost test on boost version < N is equivalent to just
>>>> unconditionally suppressing it, no?
>>>
>>> No - because boost version <= 1.75 math library supports C++03 while
>>> other versions don't/wont.
>>
>> I think the point was that with the Boost version check you won't be
>> running these tests *at all* in the current and future Boost.
>>
>>>> Isn't the goal to only suppress it when not compiling >= C++11?
>>> yep
>>>
>>>> Shouldn't you just check __cplusplus >= 201103 for that?
>>>
>>> Hmmm - is this portable on all compilers? Is this part of config.hpp?
>>
>> __cplusplus is a standard C++ macro, but not all compilers
>> consistently define it to >= 201103 in C++11 mode. Most notably, MSVC
>> doesn't.
>
> The compilers that emulate the msvc non-standard preprocessor, such as
> the VC++ based versions of Intel C++ and also NVCC I believe, report
> incorrect __cplusplus values. I also recall that some past versions of
> gcc reported an incorrect _cplusplus value, although I do not recall in
> which gcc version this was corrected.
gcc-4.6 and below had an incorrect value of '1' and it was fixed to be
correct for gcc-4.7 on up. Not that I would bother worrying about such
old compiler versions of gcc myself.
> So unfortunately it is not
> completely reliable, even with major compilers. BTW the new C++ standard
> non-default preprocessor ( /Zc:preprocessor ) in VS2019 gets it right
> and is a very good C++ standard preprocessor.
>
>>
>> If you want to check macros (which is what I'm doing in Boost.Integer
>> to solve a similar problem with Boost.Multiprecision) then I'd suggest
>> to check Boost.Config macros for the particular C++11 features that
>> are required by Boost.Math. You may even peek in Boost.Math sources to
>> see what these macros are, if they are checked there.
>
> Yes, that is the only reliable solution right now.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk