comp.lang.c
[Top] [All Lists]

Re: ?: as an lvalue

Subject: Re: ?: as an lvalue
From: Andrey Tarasevich
Date: Mon, 31 Mar 2008 11:57:07 -0700
Newsgroups: comp.lang.c


Dave Hansen wrote:

I believe the syntax is legal.

Legal where? In C? No, it is not.

It just doesn't do what the OP wanted
it to.

It doesn't do anything. It is illegal in C.

Consider that it parses as

   (1>0)?(aa):(b=10);

But it doesn't parse like that in C.

Change it to 1<0?aa:b=10; and see the result...

The result will be the same: a diagnostic message triggered by the attempt to assign to a non-lvalue.

--
Best regards,
Andrey Tarasevich

<Prev in Thread] Current Thread [Next in Thread>
Privacy Policy