cond. op. on ='s LHS

Dan Bernstein brnstnd at kramden.acf.nyu.edu
Thu Feb 21 07:23:47 AEST 1991


In article <335 at ptcburp.ptcbu.oz.au> michi at ptcburp.ptcbu.oz.au (Michael Henning) writes:
> int	array[10][10];
> 	*array
> The type of the expression after dereferencing is "array of 10 ints", which
> is *not* an lvalue.

Either (1) array types are never lvalues, or (2) array types can never
be assigned to even if they are lvalues. I don't know which way the
standard defines lvalues; I find (2) a simpler approach, but in any case
(1) and (2) produce the same results.

None of this is relevant to the question at hand, which is whether

  *(cond ? &a : &b) = x

is valid. It is, provided that a = x and b = x are valid. It will work
under any sane compiler. It must work under an ANSI compiler.

---Dan



More information about the Comp.lang.c mailing list