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] |
Why do you think it must give you a warning? x=2 returns some result, and x++ also returns some result.
Arturas M.
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;
}
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |