On Tue, 11 Mar 2003 17:46:17 +0100, Dirk Gerrits
<[EMAIL PROTECTED]> wrote:


>> In effect I would prefer the one without __LINE__. But if any compiler
>> warns about duplicate typedefs than it's better having a single
>> version, with __LINE__, than #ifs.
>> 
>> Also I have a slight preference for using void instead of char, as
>> suggested by Greg:
>> 
>> 
>>   typedef void boost_static_assert_typedef
>
>Perhaps I missed a part of the discussion, but what is wrong with Jaap's 
>suggestion:
>
>#ifdef BOOST_STATIC_NDEBUG
>     #define BOOST_STATIC_ASSERT( B ) BOOST_STATIC_ASSERT_IMPL( true )
>#else
>     #define BOOST_STATIC_ASSERT( B ) BOOST_STATIC_ASSERT_IMPL( B )
>#endif
>
>?

Well, considering that what we want is just a no-op, which do you
prefer?

a)  typedef ::boost::static_assert_test<
      sizeof(::boost::STATIC_ASSERTION_FAILURE< (bool)( true ) >)>
        BOOST_JOIN(boost_static_assert_typedef_, __LINE__);

(I've just picked up one of the implementations in static_assert.hpp,
but the others don't differ too much.)


b)  typedef void boost_static_assert_typedef;


As I said however, there can be compilers that warn about duplicate
typedefs like

namespace xyz {
   typedef void boost_static_assert_typedef;
   typedef void boost_static_assert_typedef;

}

(To be honest, I'm afraid some compiler even gives an error, confusing
the C rule with the C++ one. But I don't know of any (fortunately
:-)). Anyhow, let's not put the cart before the horse. If such a
compiler shows up then we'll consider using __LINE__; before that,
let's just use

  typedef void boost_static_assert_typedef


Genny.

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Reply via email to