This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

warning from assert


I'm using gcc 4.2.1 and getting a warning from the use of the assert macro
that I'd like to avoid.  My source looks like:

=========================================
#include <assert.h>

void foo()
{
    int *a;

    assert(&a);
}
=========================================

When I run "gcc -Wall -c assert.c" on this, I get:

warning: the address of 'a' will always evaluate as 'true'

While the warning is correct and helpful in many situations, the problem
is that in my real code, the assert macro is inside another macro which
gets used in a lot of places and I believe that for some callers, the
assert check is useful, so I don't want to just delete the use of assert.

Any suggestions?

Thanks,

  Michael


      ____________________________________________________________________________________
Be a better friend, newshound, and 
know-it-all with Yahoo! Mobile.  Try it now.  http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]