Boost logo

Boost :

From: Gennaro Prota (gennaro_prota_at_[hidden])
Date: 2003-03-11 10:49:08


On Mon, 10 Mar 2003 20:41:26 -0800, "Jaap Suter"
<J.Suter_at_[hidden]> wrote:

>> #define BOOST_STATIC_ASSERT(c) \
>> typedef char boost_static_assert_typedef
>>
>> When using several asserts in the same context some compilers could
>> complain about the duplicate typedef; if so pasting the expansion of
>> __LINE__ shouldn't be that expensive either.
>
>That seems indeed the best solution to me (with the __LINE__ included) as
>most of the time is spend in calculations for the actual expression.

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

>> But all this conjectures
>> should be backed up by some measurement. Jaap?
>
>Agreed. I will do some measurements this week and report back in a few days.

Nice :-)

Genny.


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