Jed Brown wrote: > On Thu, 21 Jan 2010 15:44:43 +0000, Mateusz Loskot <[email protected]> wrote: >> Why it can not work, actually? > > C++ does name mangling so it's difficult to determine what the symbol > actually is (you have to know about various classes and templates that > may be in scope), therefore the interface would look a bit different.
After some testing I did yesterday, I would add that one of the problems making it difficult to provide elegant macro checking C++ functions is the fact that in C++ functions can be overloaded. I suppose that the only flexible, robust and also elegant way to provide cross-platform macros for detecting C++ (also with mixed in C99, TR1, C++0x, etc.) features is to develop one macro per feature (function, macro, etc.) For instance, 1) check_cxx_fabs - checks std::fabs in <cmath>, optionally falls back to ::fabs in <math.h> if a systems has problems with std:: (i.e. Visual C++ 6.0) 2) check_cxx_isnan - tries if C++ impl. has C99 compatibility [1] additions, on some systems available as std::tr1::isnan on others as std::isnan, if fails, then falls back to system specific functions like _isnan() form Visual C++ or __inline_isnand from XCode, etc. It would probably generate large number of small macros, but I can't see a more robust and flexible way to make such checks in reusable form. Perhaps it could make into the CMake distribution one day :-) [1] http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2004/n1568.htm Best regards, -- Mateusz Loskot, http://mateusz.loskot.net Charter Member of OSGeo, http://osgeo.org _______________________________________________ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
