warning from assert

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux