This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [v3] Use Solaris prototypes if possible (PR libstdc++-v3/1773)


On Thu, 18 Aug 2011, Marc Glisse wrote:

I think the current patch is good enough for now

Actually, could someone please append to this comment in tr1/cmath:


  // Note: we deal with fabs in a special way, because an using std::fabs
  // would bring in also the overloads for complex types, which in C++0x
  // mode have a different return type.

Something like:

  // With __CORRECT_ISO_CPP_MATH_H_PROTO1, math.h imports std::fabs in the
  // global namespace after the declarations of the float / double / long
  // double overloads but before the std::complex overloads.

so we remember why it works, why it breaks if users do silly things, and what needs changing if another platform tries to define __CORRECT_ISO_CPP_MATH_H_PROTO1.

In the longer term, there is the usual idea that we could rename the current cmath (just taking this one as an example) to math.h, make it #include_next the system math.h (instead of plain #include), and have a trivial cmath that just includes math.h. This way all the goodness in cmath would already be available in math.h, conforming to D.5 (which one between math.h and cmath is a trivial wrapper to the other is a technical detail that doesn't matter if both are installed in the same directory).

... and I forgot that this requires adding many lines like: using std::thing; in the global namespace after the declarations in namespace std.

--
Marc Glisse


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]