duplicate typedefs and system headers ?

Luigi Rizzo rizzo at iet.unipi.it
Wed Jan 28 04:12:10 PST 2009


On Wed, Jan 28, 2009 at 12:47:44PM +0100, Christoph Mallon wrote:
...
> >Would this be better/more compliant with standards -- i.e.,
> >is the following code correct ? gcc seems to have no objections.
> >
> >	struct foo;
> >	int a(struct foo *);
> >	typedef struct foo bar;
> >	int a(bar *x) { ... }
> 
> What is the problem with just including the correct header? This would 
> be The Right Thing(tm). Everything else is just an ugly hack.

In this context I only need to know that a typedef (or struct)
with that name exists, not its internals.

The "correct header" defines the actual structure and has tons of other
dependencies which make the code harder to read, maintain and compile.

Again, if I had a chance to fix the underlying header(s) I would do,
but at least right now I don't have such a possibility.

	cheers
	luigi


More information about the freebsd-current mailing list