Is it safe to do this?
Thanks in advance.Code:namespace std { #include "math.h" }
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
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)
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
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)
N.. Next version.. (>.<)
Just GET it OFF out my mind!!