🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #3162

struct* mention before declaration/definition

#3162
From: Matt S Wartell
Date: Fri, 21 Jun 1991 14:40
32 lines
1294 bytes
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
Technical Details
Message-ID: <142762@unix.cis.pitt.edu>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!unix.cis.pitt.edu!msw

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!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