Subject: Re: a new KNF (and some comments)
To: None <hauke@Espresso.Rhein-Neckar.DE, firstname.lastname@example.org>
From: Chris Torek <torek@BSDI.COM>
Date: 01/21/2000 18:59:17
>In headers files that include user-accessible prototypes, you CANNOT
>include variable names, as they intrude on the user's namespace.
To be 100% accurate, this should say: "if you use names, they must
be in the implementor's name spaces."
Back with Keith Bostic was writing up the original KNF, and we
were putting in prototypes and __P's, he was originally going to
write things like:
FILE *fopen __P((const char *path, const char *mode));
I pointed out that "path" and "mode" are "user space" names that
could be #defined:
#define path "/foo/bar"
which would result in syntax errors or worse, and suggested:
FILE *fopen __P((const char *__path, const char *__mode));
but he objected to the double underscores, so we ended up with
"no names at all".
The "no names at all" method works fairly well as long as the
parameters themselves are hard to confuse. For instance, the
POSIX fdopen function takes one "int" and one "char *", and it
is impossible to get them wrong without at least a compiler warning.