modern-cpp
modern-cpp copied to clipboard
The M_PI macro is not part of the C / C ++ language standard.
#ifndef M_PI
#define M_PI acos(-1)
#endif
The code snippet after #include <math.h> guarantees correct operation. It would be better to additionally check that we do not have a C ++ 20 or newer vessel and if we are to use the stencil constant from the C ++ standard library. The M_PI macro is an extension of the C standard.
🏅 2 XP granted for @WojAbuk Thanks for raising this Issue to help to make the course better!