typedef struct in C and C++

Martyn Tebby martyntebby@yahoo.com
Wed Oct 17 05:25:00 GMT 2001


Whilst pulling C headers into a C++ program I came across the following 
problem.

	struct abc_t;
	typedef struct abc_struct {} abc_t;
	struct abc_t;

compiles fine as C, but fails as C++ with the errors

	a.c:2: conflicting types for `typedef struct abc_struct abc_t'
	a.c:1: previous declaration as `struct abc_t'

Is this correct standard behaviour?

Is there a way around it without changing the existing C headers?

Note:
I tried this with gcc 2.95.2, 2.95.3 and 3.0 (snapshot)

Martyn Tebby

_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com




More information about the Gcc-help mailing list