mark@cci632.UUCP (Mark Stevans) (07/29/87)
If you attempt to declare a function argument that is not present in the argument list, like in the following program: main() { bar(3); } bar(contect) int context; { } the C compilers will give an error message about "declared argument context" not found. However, the following program: int context; main() { bar(3); } bar(contect) int context; { } passes both "cc" and "lint" on both System V and 4.2bsd without giving any messages to inform you that you misspelled "context" as "contect". The compiler seems to think that there are two arguments: context and contect. Lint will tell you that you are hiding your global, and that the two arguments of bar, context and contect, are unused. I believe this is a bug. In fact, the above situation was actually encountered by a colleague, so this is not a purely theoretical issue. Mark "Bugsy" Stevans cci632!mark
guy%gorodish@Sun.COM (Guy Harris) (07/30/87)
> I believe this is a bug.
Yes, this is a bug. There is a fix to "pftn.c" that will, at least,
make the compiler complain that "declared argument context is
missing". I think I posted the fix to comp.bugs.sys5 and/or
comp.bugs.4bsd a while ago; you might try digging through your
archives for that. If it doesn't turn up, I'll repost it.
Guy Harris
{ihnp4, decvax, seismo, decwrl, ...}!sun!guy
guy@sun.com