consistency in declaration

david.f.prosser dfp at cbnewsl.ATT.COM
Fri Jun 16 23:23:29 AEST 1989


In article <263 at maytag.waterloo.edu> giguere at aries5.waterloo.edu (Eric Giguere) writes:
}In article <64 at BLEKUL11.BITNET> SAAAA04 at BLEKUL11.BITNET writes:
}>To my surprise the following happened with the waterloo C compiler (for VM/CMS)
}
}Wow! An IBM mainframe user reading this group...
}
}>it refuses:
}
}>void foo(int , int y);
}
}>but (of course) accepts:
}
}>void foo(int x, int y);
}>void foo(int , int);
}
}>Do I have to be consistent ? Or is this a bug in the compiler ?
}
}It's not a bug.... it's a feature.  Seriously, the ANSI specs state that
}a function prototype can accept types or types with IDs but not both 
}in the same declaration.  So, yes, you do have to be consistent.
}
}(I should know, I spent a lot of time debugging all the ANSI stuff we put
}into the compiler...)
}
}Eric Giguere                                  268 Phillip St #CL-46
}For the curious: it's French ("jee-gair")     Waterloo, Ontario  N2L 6G9
}Bitnet  : GIGUERE at WATCSG                   (519) 746-6565
}Internet: giguere at aries5.UWaterloo.ca         "Nothing but urges from HELL!!"

Not quite.  The pANS requires that there be identifiers present for all
prototype parameters only for a function's definition.  If it's just a
declaration, one can arbitrarily include or exclude the identifiers.

It would have been nice to be able to exclude identifiers even in function
definitions as that would be a linguistic way of stating that the parameter
is unused.  C++ includes this feature, but the X3J11 technical committee
didn't buy into it.

Dave Prosser	...not an official X3J11 answer...



More information about the Comp.std.c mailing list