Boost logo

Boost :

Subject: Re: [boost] suggestion on assertion macros
From: Mateusz Loskot (mateusz_at_[hidden])
Date: 2010-03-14 14:57:51


Roland Bock wrote:
> Mateusz Loskot wrote:
> [snip]
>>
>> I forgotten about -Wextra option and now GCC 4.4.1 reports the same
>> worning, indeed. I was wrong, the assert macro is not that clever as I
>> suggested
>>
>> $ g++ -E -pedantic -Wall -Wextra -DNDEBUG test.cpp
>> int main()
>> {
>> int* p = 0;
>> (static_cast<void> (0)); // assert macro
>> }
>>
>> $ g++ -pedantic -Wall -Wextra -DNDEBUG test.cpp
>> test.cpp: In function ‘int main()’:
>> test.cpp:4: warning: unused variable ‘p’
>
>
> So what do you think of my re-definition?

It's OK, but personally I would not redefine the assert macro,
but define it as a new enhanced macro for use in my project

#define MYLIB_ASSERT(cond)

Best regards,

-- 
Mateusz Loskot, http://mateusz.loskot.net
Charter Member of OSGeo, http://osgeo.org

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