Token pasting in #include directive

T. William Wells bill at twwells.com
Thu Nov 30 01:04:17 AEST 1989


In article <970 at sdrc.UUCP> scjones at sdrc.UUCP (Larry Jones) writes:
: In article <18672 at watdragon.waterloo.edu>, afscian at violet.waterloo.edu (Anthony Scian) writes:
: > What about the library prototypes that are coded "int foo( int x, int y )"
: > when they should be "int foo( int __x, int __y )"?
:
: Eh?  Why is the second any more correct than the first?  Since
: the argument names in a prototype only have prototype scope, they
: can't conflict with any other names in the program and therefor
: do not need leading underscores.

Consider macros. E.g.:

#define source "you're screwed"
#include <string.h>

and assume that string.h has things like:

extern char *strcpy(char *dest, const char *source);

You make it, instead,

extern char *strcpy(char *__dest, const char *__source);

and that way the user won't screw up your prototypes.

---
Bill                    { uunet | novavax | ankh | sunvice } !twwells!bill
bill at twwells.com



More information about the Comp.std.c mailing list