Article View: comp.std.c
Article #2864Re: Pointers to Incomplete Types in Prototypes
From: Mike Vermeulen
Date: Tue, 07 May 1991 05:49
Date: Tue, 07 May 1991 05:49
26 lines
1311 bytes
1311 bytes
>>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.
Technical Details
Message-ID:
<7330009@hpfcso.FC.HP.COM>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!dali.cs.montana.edu!uakari.primate.wisc.edu!sdd.hp.com!hplabs!hpfcso!mevReferences:
<w!2g7+c@rpi.edu>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!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: <w!2g7+c@rpi.edu> Organization: Hewlett-Packard, Fort Collins, CO, USA Lines: 26