jejones@ea.UUCP (12/01/84)
Speaking of ^^ and ==== (?!), I always wondered why C didn't have &&= and
||= (with the obvious semantics).
James Jones
pkl@daisy.UUCP (Peter K. Lee) (12/05/84)
> 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. -- -- Peter Lee ...{ucbvax!amd,decwrl,ihnp4}!nsc!daisy!pkl [No news is good news]
ndiamond@watdaisy.UUCP (Norman Diamond) (12/06/84)
> > 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.
jmc@ist.UUCP (John Collins) (12/11/84)
I've often thought that it would make sense, given a structure like
struct foo {
struct foo *f_next;
int bar;
...etc...
}
and a
register struct foo *bar;
to allow something like
bar ->= f_next
meaning the same as
bar = bar->f_next
--
John Collins calling courtesy of ist
bill@uo-vax1.UUCP (bill) (12/14/84)
No, many people test ints, chars, etc. For example if i and j equal 0x01 and 0x02 then i &= j gives i = 0, but i &&= j gives i = 1. Mark Aitken {tektronix, hp-pcd}!uoregon!marka