Hi everyone,
You can typedef a struct by using the following
typedef struct x {} X, *PX;
Now, I can understand the use of the typedefs, X and PX. They allow
you to declare the structs without having to use the struct keyword.
However, I'm not quite sure of the usefullness of the struct tag 'x'.
I seem to remember someone telling me that it had something to do with
resolving circular dependencies, when file A depends on file B, and
vice versa. Also, it may have something to do with structs that refer
to themselves (from the FAQ):
1.14: I can't seem to define a linked list node which contains a
pointer to itself.
A: Structures in C can certainly contain pointers to themselves;
the discussion and example in section 6.5 of K&R make this
clear. Problems arise if an attempt is made to define (and
use)
a typedef in the midst of such a declaration; avoid this.
Could anyone shed some light on the usefulness of the struct tag 'x'?
--
comp.lang.c.moderated - moderation address: clcm@[EMAIL PROTECTED]
-- you must
have an appropriate newsgroups line in your header for your mail to be
seen,
or the newsgroup name in square brackets in the subject line. Sorry.


|