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

Re: ?: as an lvalue

Subject: Re: ?: as an lvalue
From:
Date: Tue, 1 Apr 2008 16:51:30 -0400
Newsgroups: comp.lang.c

Harald van D??k <truedfx@xxxxxxxxx> wrote:
> 
> Allowing ?: to be used as an lvalue could break code, by the way: 
> currently,
> 
>     volatile int i;
>     volatile int j;
>     rand() ? i : j;
> 
> causes a read of both i and j, while this would change to read only one 
> of them.

Huh?  The definition of ?: currently says that only one of the second
and third operands are evaluated, so either i or j is evaluated but not
both, so only one is read.

-Larry Jones

I'm getting disillusioned with these New Years. -- Calvin

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