Well, after reading Salem's response on another site (funny to run into Salem's post on another board from around two years ago, heh):
Well goo.c has the actual structure, so there is no way for foo.c to know what the members are.
All that goo.h does is basically confirm that a struct called st exists.
In foo.c, you could have
t_st *var;
but you still would not be able to access any members within that struct.
It is, in other words an incomplete type.
Incomplete types are very useful for implementing opaque interfaces. goo.h declares an opaque pointer, which any user just sees the pointer.
The actual content of the struct is private to goo.c.
It's what FILE* should be - all user code just passes around a FILE* without ever knowing what is behind it.
I'm not sure how to proceed, but it is interesting. Doesn't that imply that one of my .h files that is included in my file contains an incomplete structure definition of addrinfo?
Reputation Points: 874
Solved Threads: 352
Posting Maven
Offline 2,758 posts
since Sep 2008