Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!dali.cs.montana.edu!uakari.primate.wisc.edu!sdd.hp.com!hplabs!hpfcso!mev From: mev@hpfcso.FC.HP.COM (Mike Vermeulen) Newsgroups: comp.std.c Subject: Re: Pointers to Incomplete Types in Prototypes Message-ID: <7330009@hpfcso.FC.HP.COM> Date: 7 May 91 05:49:06 GMT References: Organization: Hewlett-Packard, Fort Collins, CO, USA Lines: 26 >>You didn't say whether there was a prior incomplete decl. > It does not matter. According to my understanding of the standard and > according to my ANSI C compiler the following is valid code: > struct bar *getbar(int); > void changebar(struct bar *, int); > > void main(void) > { > struct bar *mybar; > > mybar = getbar (1); > if (mybar) > changebar (mybar, 2); > } In the example above, the line "struct bar *getbar(int);" causes an incomplete declaration of struct bar. An earlier note complained about warning messages from the HP ANSI C compiler. However, in the example above, the HP ANSI C compiler is silent because the incomplete declaration on the first line means that the "struct bar" tag in the next line refers to "struct bar" at file scope and not prototype scope. --mev, mev@hpcomet standard disclaimer: I speak for myself and not HP.