On Mon, 2010-10-04 at 11:14 -0400, Greg Hudson wrote: > On Mon, 2010-10-04 at 06:14 -0400, Julian Foad wrote: > > The NULL macro is intended for use as a pointer. > > Only when statically cast to the appropriate pointer type. This happens > automatically in many contexts, such as assignments or prototyped > function parameters. But it does not happen automatically for variable > parameters of a stdarg function. > > So apr_pstrcat(foo, bar, NULL) really is invalid C code.
Ah. In that case, I retract my request for reversion. > It's not a > practical concern because common platforms use a single pointer > representation, but it's a fair warning for a compiler to give. The issue at hand is when NULL is defined as an unadorned '0' *and* is passed to a variadic function such as apr_pstrcat. If that's not a practical concern, that must be because the size and representation of (int)0 is the same as (char *)0. If that is true on all supported platforms, then omitting the casts is a valid option; otherwise, we need them. Experience suggests it has been fine on all supported platforms to date. - Julian