warning: unused variable(related with assert)

Hi all.

I have a large code with asserts like this
1
2
3
4
{
    bool status = func_call();
    assert(status);
}


and build it with this command:

g++ -m32 -ffloat-store -c -O3 -DNDEBUG -Wall -Woverloaded-virtual test.cc

I get this warning:
warning: unused variable "status"


The reasons of this warning are -DNDEBUG and -Wall.
I don't want to build it without -Wall(I want to get all dangerous warnings).
I can add a fictive usage of "status", for exampe

1
2
3
4
5
{
    bool status = func_call();
    assert(status);
    (void)status;     
}


Can anyone help me to give a 'beautiful' solution to this problem?


Thanks.
1
2
if( !func_call() )
     assert( !"func_call() returned false" );



Thanks a lot.
This is a 'beautiful' solution.
Topic archived. No new replies allowed.