struct declarations in dpANS C

Henry Spencer henry at utzoo.uucp
Sun Oct 23 13:12:12 AEST 1988


In article <6157 at june.cs.washington.edu> pardo at cs.washington.edu (David Keppel) writes:
>    typedef void (*rtl_fp)( struct save_t *, int n,  rtl_t *curr );
>... the "struct save_t" is declared in another file that
>depends on declarations in this (.h) file.  Even though struct save_t
>is defined before the rtl_fp is used, this declaration still causes
>the compiler to emit warnings about "argument passing between
>incomopatible pointer types" unless I precede the function declaration
>with
>    struct save_t;

This is correct.  save_t is not known at the first time it is used, i.e.
in the typedef for rtl_fp.  Therefore it is entirely proper, and indeed
highly desirable, for the compiler to object.  Adding "struct save_t;"
makes it a known, although incomplete, type.  The compiler's grumbling
about "struct save_t;" is improper; probably somebody forgot to fix
that when he added function prototypes.
-- 
The meek can have the Earth;    |    Henry Spencer at U of Toronto Zoology
the rest of us have other plans.|uunet!attcan!utzoo!henry henry at zoo.toronto.edu



More information about the Comp.std.c mailing list