|
Boost : |
From: Alisdair Meredith (alisdair.meredith_at_[hidden])
Date: 2003-03-02 21:44:20
Picking off more borland errors, I have a couple of questions on this
test case:
1/ should char be Char in the following snippet [case-error]
[Extract of static_assert.hpp starting line 53]
template <class Int, class Char>
struct Bill
{
private: // can be in private, to avoid namespace pollution
BOOST_STATIC_ASSERT(sizeof(Int) > sizeof(char)); // <-- error?
public:
...
2/ This same line line is the source of the borland error. A quick test
shows it cannot cope with the simple
BOOST_STATIC_ASSERT( 5 > 3 );
however
BOOST_STATIC_ASSERT( 5 >= 3 );
passes fine. I guess the > is fooling the template parser.
This leads to the obvious workaround of:
#if defined( __BORLANDC__ ) // Borland cannot handle > comparison
BOOST_STATIC_ASSERT(
( sizeof(Int) >= sizeof(Char) )
&& ( sizeof(Int) != sizeof(Char) )
);
#else
BOOST_STATIC_ASSERT(sizeof(Int) > sizeof(Char));
#endif
However, I am not happy patching test-cases rather than libraries. On
the other hand, having diagnosed the problem with a viable workaround, I
don't see where else to record the information. Do we have a way of
documenting known workarounds for a library?
-- AlisdairM
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk