Multiple typedefs

Doug Gwyn gwyn at smoke.BRL.MIL
Sat Apr 29 13:02:00 AEST 1989


In article <2322 at lethe.UUCP> drew at lethe.UUCP (Drew Sullivan) writes:
>typedef unsigned int foo_t;		/* from include file 1 */
>extern foo_t foo(void);
>typedef unsigned int foo_t;		/* from include file 2 */
>extern foo_t foo(void);

No, the second typedef is syntactically invalid.
The conventional way to guard against this is:
	#ifndef _FOO_T_DEFINED
	#define	_FOO_T_DEFINED
	typedef unsigned int foo_t;
	#endif
Sorry about that..



More information about the Comp.std.c mailing list