Is it safe to do this?
Thanks in advance.Code:namespace std {
#include "math.h"
}
Printable View
Is it safe to do this?
Thanks in advance.Code:namespace std {
#include "math.h"
}
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.Quote:
Originally Posted by audinue
However cmath's round, etc isn't std.
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.Quote:
Originally Posted by audinue
N.. Next version.. (>.<)
Ah well, make a hack. Make your "manual" std namespace and fill it in with the missing prototypes.