On Fri, 25 Jan 2002, Andy Dougherty wrote: > One problem noted recently on the p5p list is that if you do > > #include <perl.h> > > in your program, it exposes a *lot* of CPP #defines to your program, > whether you want them or not. This is particularly a problem if you wish > to embed perl or use it with an extensive 3rd-party library. > > For parrot, we'd ideally like to make it a lot safer to > > #include <parrot/parrot.h> > > Here's a status check on where we are currently: > > #include <parrot/parrot.h> currently #defines 198 global CPP symbols. > If you take away the autoconf-ish HAS_HEADER_* and the > proabably-quite-safe PARROT_* entries, that leaves 107 entries. > Although it's impossible to predict what vendors and third-party > software writers will do with the CPP namespace, the following 5 > entries seem particularly likely to cause mischief at some point > somewhere: > > Very general names: > UNUSED > INVALID_CHARACTER > IO_ERROR > KEY_NOT_FOUND > > Possible conflict with system headers: > SSIZE_MAX > This is #defined in parrot/io.h as 8192, but it's also > possibly defined in the system headers as the maximum size of > the Posix ssize_t type, typically INT_MAX or LONG_MAX. > Since it's not used in parrot, I'm unsure of the intent. > > I don't have a specific proposal at the moment, but would invite > others to think creatively about ways to minimize cpp pollution while > still keeping the source readable and maintainable. >
We could define those as PARROT_UNUSED, PARROT_IO_ERROR, etc. Then, we could have a parrot/aliases.h header that will define an aliases for them: #define UNUSED PARROT_UNUSED. The recommended use of this header would only be internally, and it won't be included by any of the headers that the library would require. Of course, PARROT can be replaced with PRT or with any other prefix. Regards, Shlomi Fish > -- ---------------------------------------------------------------------- Shlomi Fish [EMAIL PROTECTED] Home Page: http://t2.technion.ac.il/~shlomif/ Home E-mail: [EMAIL PROTECTED] He who re-invents the wheel, understands much better how a wheel works.