When do you use "if ( a = b )"? (was Re: Funny mistake)

Mark William Hopkins markh at csd4.csd.uwm.edu
Tue Apr 2 02:19:46 AEST 1991


In article <13983 at helios.TAMU.EDU> byron at archone.tamu.edu (Byron Rakitzis) writes:
>Last try: (though this one doesn't look as horrible as the one above)
>
>	if ((A = f1()) - 2 || (A = f2()) - 3 || (A = f3()) - 4)

THere you go!  I knew if I looked far enough down the article list, I'd see
a correction. :)

My return example should not read:
>   (Op = FindOp(S)) && return Op->Type ||
>   (Sym = NewSym(S)) & return Sym->Index;

but

>   return (Op = FindOp(S))? Op->Type: (Sym = NewSym(S)), Sym->Index;

I keep on forgetting that in their infinite wisdom the Standard Bearers forgot
to make return X a void expression.  I'll be sure to add that feature in my
next compiler...



More information about the Comp.lang.c mailing list