Some shadow fixes.

Steven King sxking@uswest.net
Thu May 18 17:51:00 GMT 2000


On Thu, 18 May 2000, Nathan Myers wrote:

> Unfortunately, the standard requires that the ::abs visible when you 
> include <math.h> be identically the same function as the std::abs.  
> it also defines.  The same applies if somebody includes <cmath> 
> and you later include <math.h>, or vice versa.
> 
> In practice, this means you have to hide the extern "C" declaration 
> in a namespace somewhere, and define a single inline forwarding 
> function to expose in various namespaces.  There are several examples 
> of this in the shadow headers already; it seems we must use the same 
> trick for the math functions too.  
> 
> Note, though, that the C++ standard doesn't include the C99 extensions,
> so any such have to be guarded with #ifdef __USE_C9X.

  But the problem here is if you do

#include <stdlib.h>
#include <math.h>

because of 7.3.3/9,  if we use a using directive, the abs in math wont be
visable in the global namespace, or if we swap the inclusion order, vice
versa (abs is overloaded in both cstdlib and cmath).

-- 
Steven King
sxking@uswest.net


More information about the Libstdc++ mailing list