modern-cpp icon indicating copy to clipboard operation
modern-cpp copied to clipboard

The M_PI macro is not part of the C / C ++ language standard.

Open WojAbuk opened this issue 3 years ago • 1 comments

#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.

WojAbuk avatar Feb 14 '22 19:02 WojAbuk

🏅 2 XP granted for @WojAbuk Thanks for raising this Issue to help to make the course better!

ziobron avatar Feb 14 '22 19:02 ziobron