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

Re: ?: as an lvalue

Subject: Re: ?: as an lvalue
From: Ben Bacarisse
Date: Mon, 31 Mar 2008 22:12:20 +0100
Newsgroups: comp.lang.c

Richard <devr_@xxxxxxxxx> writes:

> Ben Bacarisse <ben.usenet@xxxxxxxxx> writes:
>
>> Richard <devr_@xxxxxxxxx> writes:
>>
>>> "Bartc" <bc@xxxxxxxxxx> writes:
>> <snip>
>>>> Exactly why a?b:c can't appear like that on the left-hand-side of an 
>>>> assignment is a bit of a mystery; 
>>>
>>> There is no mystery about it.
>>
>> Why not help by explaining it then?  It is a mystery to me as well, so
>> least least two people would benefit from your explanation.
>
> Huh? I must be missing something here or I will be first to
> apologise.

I just wanted you to say why it seemed so obvious to you that C
outlaws the construct.  I thought that maybe you knew a good reason
why.  Lots of languages allow such things.  

> We already know that
>
> *(c?x:y)=v;
>
> is ok where x and y are pointers.
>
> But (c?x:y)=v;
>
> I dont really know what to say. 

OK, that's fine.  Your degree of certainty (that the prohibition was
not mysterious) suggested you might have something to say about it.

It is another areas in which C and C++ have diverged.  I thought there
was a desire that differences be minimised in what might loosely be
called the "common areas" unless there is a compelling reason to keep
C different.  I thought maybe you knew that reason.

-- 
Ben.

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