Re: _USE_MATH_DEFINES bug
"Mikel" <mikel.luri@gmail.com> ha scritto nel messaggio
news:1d1a7064-86dc-450c-9b98-9bef6c502ce2@i7g2000prf.googlegroups.com...
In the article mentioned by Joe, it says that, for _USE_MATH_DEFINES
to work, you have to define it before AfxWin.h is included. So, if you
define _USE_MATH_DEFINES in stdafx.h, but AFTER AfxWin.h is included,
it fails to compile (in Release).
#defining _USE_MATH_DEFINES in StdAfx.h before including header files is
fine: I've always done that, and it always worked.
It's not very clear to me what Joe was going to do: maybe is he going to use
_USE_MATH_DEFINES only in some modules (.cpp files) and not in all project?
I asked him in another post in this thread.
However, I think in these days we can use C++ to write desktop applications,
and not old C (C seems to be used a lot in the Linux world, instead).
So, I would avoid those global non-standard preprocessor-based numeric
constants, and instead I would define a C++ namespace or a C++ class with
public static constant fields, and put these constants definition there, and
access them using robust Math::Pi, Math::E, Math::Sqrt2, etc.
No need to preprocessor macros chaos.
My 2 cents.
Giovanni