Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10.1 6/24/83; site watdaisy.UUCP
Path: utzoo!watmath!watdaisy!ndiamond
From: ndiamond@watdaisy.UUCP (Norman Diamond)
Newsgroups: net.lang.c
Subject: Re: How about &&= and ||= ?
Message-ID: <6800@watdaisy.UUCP>
Date: Thu, 6-Dec-84 15:13:03 EST
Article-I.D.: watdaisy.6800
Posted: Thu Dec  6 15:13:03 1984
Date-Received: Fri, 7-Dec-84 01:10:43 EST
References: <5700031@ea.UUCP>, <25@daisy.UUCP>
Organization: U of Waterloo, Ontario
Lines: 18

> > Speaking of ^^ and ==== (?!), I always wondered why C didn't have &&= and
> > ||= (with the obvious semantics).
> > 						James Jones
> 
> &= and |= are sufficient already.  Remember ... C doesn't really
> have booleans.

False!  Consider a variable v containing the integer 1, and an expression
that evaluates to 2.
v &= expression;  /* ends up as 0 */
v &&= expression; /* ends up as 1 -- furthermore, expression need not
                                     even be evaluated */

Have I missed something, or why has no one pointed out how the proposed
^^ differs from && and || ?  && and || avoid evaluating their right-hand
operands when unnecessary, and can be used for (e.g.) don't examine array
element if subscript is out of range, don't call function if argument has
certain value, etc.  ^^ must always evaluate both sides.