Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!unix.cis.pitt.edu!msw From: msw@unix.cis.pitt.edu (Matt S Wartell) Newsgroups: comp.std.c Subject: struct* mention before declaration/definition Message-ID: <142762@unix.cis.pitt.edu> Date: 21 Jun 91 14:40:54 GMT Organization: University of Pittsburgh Lines: 32 I was porting some code to a PC under Turbo C++ 1.0 and encountered some wierdness. Turbo C claims to be ANSI conformant, so I wanted to know if this is proper behavior. The code I am porting has its header files out of order, so one of the source files pre-processes into: /* declaration of function */ void add_version(int a, struct B *b); /* definition of structure */ struct B { ... }; /* definition of function */ void add_version(int a, struct B *b) { ... } When the compiler gets to the function definition, it complains of a type mismatch in parameter b. It is our impression that the compiler should produce an error at the function _declaration_ because the declaration uses an undefined, undeclared type. Does anyone know why the compiler did this, and whether or not it should have? Thanks in advance. -- matt wartell, university of pittsburgh msw@unix.cis.pitt.edu