Pointers to Incomplete Types in Prototypes

Robert Elz kre at cs.mu.oz.au
Sat May 4 15:20:40 AEST 1991


Disclaimer: I know absolutely nothing about ANSI C ...

I can't see how its possible for

	type foo(struct bar *arg);

to possibly be considered as any kind of a definition of the
struct tag "bar".  Whether "bar" is defined elsewhere or not,
this is (and can only be) a reference to "bar".

Struct tags are (should be, surely) only defined in a context
as

	struct bar { ... };

The question of the scope inside the function prototype can only
possibly be relevant to names defined there, of which "bar" is not
one in the above example.  It would be in

	type foo(struct bar { ... } *arg);

which would *always* be a meaningless prototype, regardless of
whether bar was defined elsewhere or not.

It seems as if the compiler involved is treating the reference
to bar in the first prototype above as a definition, as it hadn't
seen a definition before.  That is surely a bug.

Would all those people who have blindly been quoting the standard
on these issue please turn to the paragraph that defines struct
tag definition, and please quote form there as well.

kre



More information about the Comp.std.c mailing list