Path: utzoo!attcan!uunet!lll-winken!lll-tis!ames!amdahl!pacbell!att!alberta!teletron!andrew
From: andrew@teletron.UUCP (Andrew Scott)
Newsgroups: comp.lang.c
Subject: Structure pointer question
Message-ID: <361@teletron.UUCP>
Date: 10 Jun 88 16:42:15 GMT
Organization: TeleTronic Communications Ltd., Edmonton, Alta.
Lines: 26


I have a question regarding pointers to structures and their use in data
structure definitions found in #include files.

Suppose I wish to declare a commonly used data structure, which has as one
of its fields a pointer to a less often used structure.  I wish to define
the structure "templates" in different #include files:

foo.h:					bar.h:

struct bar;				struct bar {
						...
struct foo {				};
	...
	struct bar *f_b;
};

Is it alright to #include "foo.h" and not "bar.h" in a source file if the
fields of "struct bar" are not used?  I would think that it would be fine
as long as pointers to structs are all the same "flavor".  The compiler
I'm using doesn't mind.

I suppose I could #include both if I had to, but I'd rather not because of
modularity reasons.  I'm just wondering what the usual practice is.
-- 
Andrew Scott		andrew@teletron.uucp    - or -
			{att, ubc-cs, watmath, ..}!alberta!teletron!andrew