Domanda

I find it quiet annoying that I have to use the macro _USE_MATH_DEFINES in order to get the value of pi into my program. Or I need to define it myself in one of my own headers. Or I have to use boost and all that.

It just annoys me, that there isn't a standard c++ header defining that constant in a portable way. Is there any particular reason that math constants like pi are not in the c++ standard? Could it be in one of the next versions of the standard?

È stato utile?

Soluzione

I would assume its not standardized because its not really a major concern. I really do not see any hassle in just writing down a #define or const static, or just making a header with a bunch of math constants you may need. Its not really anything anyone composing the standard has on his mind while trying to improve the language.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top