Multiple typedefs

Drew Sullivan drew at lethe.UUCP
Wed Apr 26 04:46:50 AEST 1989


Under ANSI-C the I think that the following is legal:

+------------------------------------------------------------
| #define foo_t	unsigned int		/* from include file 1 */
| extern foo_t foo(void);
| 
| #define foo_t	unsigned int		/* from include file 2 */
| extern foo_t foo(void);
+------------------------------------------------------------

But, is the following legal:

+------------------------------------------------------------
| 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);
+------------------------------------------------------------

If it is not legal how do we guard the multiple typedefs.
Do we use #ifdefs, and if so, are there to be any conventions.
-- 
  -- Drew Sullivan, <drew at lethe.uucp>



More information about the Comp.std.c mailing list