Newsgroups: comp.lang.c Path: utzoo!henry From: henry@zoo.toronto.edu (Henry Spencer) Subject: Re: Undefined structures Message-ID: <1991Feb4.205141.11731@zoo.toronto.edu> Organization: U of Toronto Zoology References: <442@newmedia.UUCP> Date: Mon, 4 Feb 1991 20:51:41 GMT In article <442@newmedia.UUCP> jim@newmedia.UUCP (Jim Beveridge) writes: > extern int callvw(struct _vw_package *pack); > >I find this rather amazing considering that "struct _vw_package" >is undefined. Not an issue. It is an "incomplete type", so there are vague restrictions on doing certain things with it, but declaring pointers to incomplete types is perfectly legal. The intuitive rule is that you can do anything that doesn't require knowing the size or contents of the struct (unfortunately, ANSI C phrases it in about that way, but doesn't bother saying precisely where the size is needed). This esentially means that all pointers to struct have to use the same representation. What GCC is trying to warn you about is that this incomplete type exists only within that one declaration, meaning that there is no way to declare anything else with the same type. -- "Maybe we should tell the truth?" | Henry Spencer at U of Toronto Zoology "Surely we aren't that desperate yet." | henry@zoo.toronto.edu utzoo!henry