[net.lang.c] limitations of cast, pointers, &c...

breuel@harvard.ARPA (Thomas M. Breuel) (11/01/84)

Thanks for your replies. Casting the lhs of an assignment might be
defined in an unambiguous way as, for example:

(type)x = y; <=> *(type *)&x = y;

which would be useful and unambiguous, but different in meaning from
a cast as it is usually used. It might also be defined as:

(ytype)x = y; <=> x = (xtype)y;

where xtype and ytype refer to the types of x and y respectively, and
where the construct is undefined if the cast on the lhs is not to the type
of the expression on the rhs.

In a similar manner it would also be possible to fill 'typedef ref *ref;'
with meaning. At any rate, replacing the dereferencing operator
'*' by '#define deref(x) *(ref *)x' gives the type 'ref' the desired
properties and thereby solves my problem.

				Yours sincerely,
				Thomas.

				(breuel@harvard.arpa)