Addressing struct without ->
AthanasiosTom Zougas
zougas at me.utoronto.ca
Sat Feb 2 09:23:38 AEST 1991
wolfram at cip-s02.informatik.rwth-aachen.de (Wolfram Roesler) writes:
>NIBMSCM at NDSUVM1.BITNET writes:
>> ...Pascal, I had the capability to use
>>the 'using' keyword, giving the address of a structure and then address
>>the elements of that structure without the necessity of using the
>>ptr->element notation (could simply use element).
>#define X ptr->fooptr->foo.bar.bar.baz.foobar->foobaz.x
>and now write
> X->something
>instead of (well you know what).
Personally, I hate these types of "magic" defines. Why not just use:
X = ptr->fooptr->foo.bar.bar.baz.foobar->foobaz.x
and the access the elements within using:
X.element
where X is of the proper type. This also saves on all those indirections.
Tom.
--
I can be reached at...
zougas at me.utoronto.ca || zougas at me.toronto.edu || ...!utai!me!zougas
More information about the Comp.lang.c
mailing list