Hi, I'm using gcc-3.3.4 and I get a warning with the following code that I don't quite understand:
Code:
#include <stdio.h>
void myfunc(int *a)
{
printf("%d\n", *a);
}
int main(void)
{
int a = 1, b = 2;
myfunc(&(a == 1?a:b));
return 0;
}
The warnings I get are:
Quote:
$ gcc -Wall foo.c -o foo
foo.c: In function `main':
foo.c:12: warning: use of conditional expressions as lvalues is deprecated
foo.c:12: warning: use of compound expressions as lvalues is deprecated
|
If I change
myfunc(&(a == 1?a:b)); to
myfunc(&(1?a:b)); I don't get the warnings.
I know that the code I pasted is completely useless, but I use that conditional test to pass arguments to functions sometimes. My question is why would something like that be deprecated? I can't find anything in the announcements at
http://gcc.gnu.org that say that it will be deprecated.
On another machine running gcc-3.2.3 I don't get the warnings using that same code.
Any insight would be appreciated. Thanks!