Path: utzoo!attcan!uunet!wuarchive!zaphod.mps.ohio-state.edu!uwm.edu!bionet!agate!ucbvax!BRL.MIL!mike From: mike@BRL.MIL (Mike Muuss) Newsgroups: comp.sys.sgi Subject: CC bug in IRIX 3.3.1 ? Message-ID: <9101120521.aa04946@WOLF.BRL.MIL> Date: 12 Jan 91 10:21:28 GMT Sender: usenet@ucbvax.BERKELEY.EDU Organization: The Internet Lines: 63 The following C program generates this error message on an SGI 4D/280 running IRIX 3.3.1: 80 wolf> cc -c goo.c ccom: Error: goo.c, line 20: redeclaration of formal parameter, stp int (*ft_shot)(struct soltab *stp); ---------------------------------------^ ccom: Error: goo.c, line 21: unknown size }; ^ ccom: Error: goo.c, line 21: unknown size }; ^ This program fragment represents valid ANSI C code. struct soltab { int a; int b; }; int (*prep)(struct soltab *stp); int (*grep)(struct soltab *stp); int j; /* This way does work */ struct rt_gunktab { int (*ft_prep)(struct soltab *); int (*ft_shot)(struct soltab *); }; /* This way does not work */ struct rt_functab { int (*ft_prep)(struct soltab *stp); int (*ft_shot)(struct soltab *stp); }; It would seem that using variable names inside prototypes is causing the compiler difficulties with a symbol table of some sort. Quoting from K&R (2nd ed), pg 218: "If the declarators in the parameter declarations contain identifiers and the function declarator does not head a function definition, the identifiers go out of scope immediately." and "In the new-style declaration int strcpy(char *dest, const char *source), rand(void); .... The parameter names are effectively comments." While this style of declaration seems to work in simple cases on the SGI, structures containing multiple function pointers with prototypes that have repeated parameter names seem to make the compiler choke. Just for reference, this is not a problem on the Cray ANSI C compiler. Could this please be filed as a Software Problem Report? Best, -Mike