Is it safe to do this?
Thanks in advance.Code:namespace std { #include "math.h" }
This is a discussion on namespace and include within the C++ Programming forums, part of the General Programming Boards category; Is it safe to do this? Code: namespace std { #include "math.h" } Thanks in advance....
Is it safe to do this?
Thanks in advance.Code:namespace std { #include "math.h" }
Last edited by audinue; 08-10-2009 at 11:46 AM.
Just GET it OFF out my mind!!
Adding declarations or definitions to the std namespace (or namespaces inside of it), other than certain template specialisations, results in undefined behaviour. Just #include <cmath> instead.Originally Posted by audinue
C + C++ Compiler: MinGW port of GCC
Version Control System: Bazaar
Look up a C++ Reference and learn How To Ask Questions The Smart Way
However cmath's round, etc isn't std.
Just GET it OFF out my mind!!
hmm... that is true. It looks like what C99 added to <math.h> will be included in the next version of the C++ standard for <cmath>, but for now you should accept that they are not in the std namespace.Originally Posted by audinue
C + C++ Compiler: MinGW port of GCC
Version Control System: Bazaar
Look up a C++ Reference and learn How To Ask Questions The Smart Way
N.. Next version.. (>.<)
Just GET it OFF out my mind!!
Ah well, make a hack. Make your "manual" std namespace and fill it in with the missing prototypes.
For information on how to enable C++11 on your compiler, look here.
よく聞くがいい!私は天才だからね! ^_^