Addressing struct without ->
Karl Heuer
karl at ima.isc.com
Thu Jan 17 07:10:35 AEST 1991
In article <1290 at mti.mti.com> adrian at mti.UUCP (Adrian McCarthy) writes:
>What bothers me about x.y and x->y is that I shouldn't *in many cases* have
>to worry about whether x is an instance of a struct or a pointer to one.
I see no significant difference between this and the related worry about
whether `i' is an int or a pointer to one. If it really bothers you, use
C++ and references; or if that's too much trouble, emulate the effect with
#define x (*px)
(I often use this when dealing with what is logically call-by-reference.)
Karl W. Z. Heuer (karl at ima.isc.com or uunet!ima!karl), The Walking Lint
More information about the Comp.lang.c
mailing list