ke********@gmail.com wrote On 10/29/07 11:55,:
Hi folks,
I have a question about accessing the member of a build-in struct.
Eg.
struct {
struct {
int x;
int y;
} pt;
int ...
...
} info;
I remember there is a method to simplify the access of info.pt.x using
info.x, but I cannot recall that. Can you guys help me with that?
Some compilers allow "anonymous" struct elements, but
this is not permitted in Standard C (except for a special
case involving bit-fields, not applicable here).
You could play preprocessor games, like
#define X(s) ((s).pt.x)
.... but in my experience such tricks are usually more
trouble than they're worth.
--
Er*********@sun.com