httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Greg Stein <>
Subject feature test macros (was: cvs commit: apache-2.0/src/lib/apr/lib apr_snprintf.c)
Date Fri, 21 Jan 2000 03:47:50 GMT
On Thu, 20 Jan 2000 wrote:
> You and I have had this discussion before.  Apache uses #ifdef always.

Yes... I wasn't trying to reopen it, thus the [ ] notation I use for
tangental/aside remarks.

> That was the groups decsions.  That decision doesn't work for APR.  APR
> always uses #if.  If there is a problem with macros that aren't defined,
> we use #if defined(foo).  This removes the confusion between #if and
> #ifdef inside of APR.

Understood. No problem.

Now, for my edification, and hopefully for others, let's continue...

> As far as removing one of the macros goes, they both need to be defined.
> The first is defined by autoconf automatically.  The second is defined
> because APR needed namespace protected macros for some of the information
> required by public header files.  The name similarity is unfortunate, and
> is my fault, but they really do mean two different things.  The first
> means this platform has netinet/in.h.  The second means APR needs the
> information in netinet/in.h in order to compile cleanly.  This is a small
> difference, but it is real. 

Ah ha! This wasn't clear. Hrm. Would a better name be something like:



In other words, the public header should use netinet/in.h? Or maybe

Internally, APR would continue to use HAVE_NETINET_IN_H because it *does*
mean, "is that available?"  Although: why would an internal routine need
that, if it can use the definitions created through the public headers?

> Yes, there are three similar macros, but the rules for them are quite
> simple.  Apache has one set of autoconf defined macros.  APR has a similar
> set of macros which it uses for internal decisions, and a very small set
> of namespace protected macros which are available for APR programs to use.


I don't know enough about APR's internal use of HAVE_NETINET_IN_H, but it
seems suspicious, as mentioned above. BUT: ignore this, as I don't need to
really learn this right now, and I don't want to impose on you to explain
something that is obviously working well :-)  "ignorance is bliss"

> Apache has decided that it doesn't want to use APR's macros, otherwise I
> would advocate getting rid of Apache3's definition of HAVE_NETINET_H and
> just use APR_HAVE_NETINET_H.  But the real solution is to stop including
> netinet/in.h at all in Apache, and just include apr_network_i.h.  If there
> is really a need for netinet/in.h in Apache, then we haven't done our job
> with APR, because not everybody has netinet/in.h.  

I completely agree. Apache shouldn't use HAVE_NETINET_H because it should
not be using stuff like that... APR should be replacing those uses.

Note that Apache shouldn't use APR_HAVE_NETINET_H; as you stated above,
the APR macro has a different semantic. Apache should have its own, or
should elminate its usage altogether.

> To boil this down because I am tired and sick of computers today, APR
> should have two macros, one with APR in front and one without.  Apache
> should have zero macros and it should just include apr_network_io.h.  APR
> ALWAYS uses #if because it is more flexible.  

No problem. Should the APR_* macros be slightly renamed, to better reflect
the semantic that you were describing?


Greg Stein,

View raw message