C's triadic operator.

Jim Gardner jagardner at watmath.waterloo.edu
Wed May 17 18:21:43 AEST 1989


In article <26212 at watmath.waterloo.edu> rbutterworth at watmath.waterloo.edu (Ray Butterworth) writes:
>Unfortunately that last rule is not the one in the Standard.
>What it has is:
>- If one expression is a pointer to (possibly qualified) void
>  and the other is any arbitrary type, the arbitrary pointer
>  is coerced to be an unqualified pointer to void.

There is a better way to read the standard:

	(from section 3.3.15)
	"If both the second and third operands are pointers [...]
	 the result type is a pointer to a type qualified with all the type
	 qualifiers of the types pointed to by both operands. Furthermore,
	 [...]; otherwise, one operand is a pointer to void or a qualified
	 version of void, in which case the other operand is converted to
	 type pointer to void, and the result has that type."

The last part is misleading.  The otherwise clause is in a sentence that
begins with "furthermore", so the union of qualifications specified in
the first sentence also has effect in the second.  The result type is not
"pointer to void", but "pointer to void with all the type qualifiers...".

David Tanguay != Jim



More information about the Comp.std.c mailing list