glenm@mako.UUCP (Glen McCluskey) (04/16/85)
Is it considered kosher to use the ``? :'' operator in computing an lvalue, as in int a, b, c; *(a ? &b : &c) = 47; This is certainly legal C, but I never recall seeing it used in any code I have looked at. Glen McCluskey ..tektronix!mako!glenm
vishniac@wanginst.UUCP (Ephraim Vishniac) (04/17/85)
> Is it considered kosher to use the ``? :'' operator > in computing an lvalue, as in > > int a, b, c; > > *(a ? &b : &c) = 47; > > This is certainly legal C, but I never recall > seeing it used in any code I have looked at. Legality may not be enough: some C compilers will choke on it anyway. I recently discovered that the Mark Williams C compiler (for 8086/8088) refuses to accept: int a[3], b; a[ b ? 1 : 2] = 47; It complains that the stuff on the left of the assignment is not an lvalue. -- Ephraim Vishniac [apollo, bbncca, cadmus, decvax, harvard, linus, masscomp]!wanginst!vishniac vishniac%Wang-Inst@Csnet-Relay
hkr4627@acf4.UUCP (Hedley K. J. Rainnie) (04/22/85)
Reminds me of a lovely Algol68 nubbin: INT a,b,c; IF a THEN b ELSE c FI := 47 or for brevity, using the overloaded parens (a | b | c) := 47 Nice eh? Hedley.