Boost logo

Boost :

Subject: Re: [boost] suggestion on assertion macros
From: Roland Bock (rbock_at_[hidden])
Date: 2010-03-15 15:19:54


Emil Dotchevski wrote:
> On Mon, Mar 15, 2010 at 10:28 AM, Roland Bock <rbock_at_[hidden]> wrote:
>
>> #define assert(cond) static_cast<void>(sizeof(cond? 0: 0));
>>
>
> Presumably, (void)sizeof(cond?0:0) gives you a warning for using
> C-style cast? :)
>
Not that I know of :-) . I prefer C++ style because they are more easy
to spot than C style (e.g. by searching for "static_cast").
> How about disabling a few lame warnings and leaving assert() alone?
>
>
First of all, sorry for the typo. I wanted to and will leave assert
alone. It should have been my_assert.

Second, warnings about unused parameters or variables are useful
sometimes. Admittedly, most of the time they just seem to cost time, but
I wouldn't want to turn them off. Sometimes, they remind me of something
I had forgotten to implement or to clean up.

Regards,

Roland


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