assertion warnings

bill bill.pursell@gmail.com
Tue Nov 15 20:19:00 GMT 2005


Is there any way to get gcc to generate warnings for the following code?
-Wall gives no complaints at all.
I expect that it's asking too much to get a warning for the first 
assertion, but
the other two seem to be pretty obvious candidates for a warning.

#include <assert.h>
int
foo(int *x)
{
    *x = *x+1;
    return *x;
}

int
main()
{
    int x;
    assert(foo(&x));
    assert(x=2);
    assert(x++);
    return 0;
}



More information about the Gcc-help mailing list