PCC compiler question - (nf)

utzoo!decvax!harpo!eagle!mit-vax!masscomp!tjt utzoo!decvax!harpo!eagle!mit-vax!masscomp!tjt
Fri Apr 1 07:12:32 AEST 1983


Some of this depends on what you would like '&&' to mean as well as
how you would like assignment to behave (note the key phrase "would
like").  One possibility is for:
			a && b
to be equivalent to:
			a ? a : b
Without a re-evaluation of a. i.e. another of C syntactic devices to
trick the programmer into doing most of the optimizing.

Then the question becomes whether the statement
		a ? a : b *= c;
should make any sense.  It could, if you distribute the expression
through the conditional, and make it equivalent to:
		if (a) a *= c; else b *= c;

In the C reference manual:
			a && b
is defined as equivalent to (although not in so many words):
			a ? 1 : ( b ? 1 : 0 )
In addition, the '?' operator does yield a lvalue, but there's always
"what if ...".



More information about the Comp.lang.c mailing list