This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Partially implemented or broken C extension ?
- To: <gcc at gcc dot gnu dot org>
- Subject: Partially implemented or broken C extension ?
- From: "Dmitry A. Antipov" <dmitry dot antipov at auriga dot ru>
- Date: Fri, 24 Nov 2000 11:26:15 +0300 (MSK)
Hello all,
I have a question about GNU C extension that permits the use
of `?:' in lvalues. Consider the following program:
main () {
int a = 1, b = 2, c = 3;
(a ? a : b) = c;
}
It compiles and works fine. But
main () {
int a = 1, b = 2, c = 3;
((a > b) ? a : b) = c;
}
doesn't compile (`invalid lvalue in assignment'). But the following
text is taken from GNU C Info documentation (Generalized Lvalues):
"A conditional expression is a valid lvalue if its type is not void
and the true and false branches are both valid lvalues. For example,
these two expressions are equivalent:
(a ? b : c) = 5
(a ? b = 5 : (c = 5))"
In a second program above, all these conditions seems kept. Is this
my mistake (if yes, where ?) or something wrong with GCC ? My GCC
version is 2.95.2.
Thanks,
Dmitry Antipov <dmitry.antipov@auriga.ru>.
Please e-mail me directly if possible.