|
Boost Users : |
From: Erik (esigra_at_[hidden])
Date: 2008-03-18 13:31:40
Jean-Francois Bastien skrev:
>> We have this really neat and simple macro in our project:
>> #define compile_assert(x) typedef bool
>> COMPILE_ASSERT[(x) ? 1 : -1]
>>
>> Although it does what we need and serves us well, I
>> tried to replace
>> it with BOOST_STATIC_ASSERT. Unfortunately this resulted
>> in a lot of
>> ugly warnings throughout the compile:
>> warning: use of old-style cast
>>
>>
>
> There's the following comment in the static assert header:
>
> // Note that the argument to the assert is explicitly cast to bool using
> old-
> // style casts: too many compilers currently have problems with
> static_cast
> // when used inside integral constant expressions.
>
> The solution would be to add even more defines to use old style or
> static casts depending on which compiler is used.
>
I just wonder for how long time Boost has to maintain compatibility with
every buggy compiler that was ever released? Has not static_cast been an
ISO standard for like a decade now? And it is not extremely difficult to
implement either (unlike the export keyword).
I suppose we will just continue to use our one-liner compile_assert
(quoted above) for now. It seems to work on all our target platforms
(GCC, MacOS X, N800, MinGW, MSVC8).
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net