microsoft / DirectXMath

DirectXMath is an all inline SIMD C++ linear algebra library for use in games and graphics apps

Home Page:https://walbourn.github.io/introducing-directxmath/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Use of undefined _MANAGED and _M_CEE macros

luis-valverde-ms opened this issue · comments

Hi there! I'm hitting the following build errors when #including DirectXMath.h in a project that enables warning C4668 and treats warnings as errors (i.e. a game project in Unreal Engine):

1>...\DirectXMath.h(19): error C4668: '_MANAGED' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif'
1>...\DirectXMath.h(19): error C4668: '_M_CEE' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif'

Could we modify those macro uses to check for their existence? Thanks!

After a bit more investigation I'm not so sure about this. Replacing undefined identifiers by 0 seems to be the behavior mandated by the C++ standard so it seems somehow wrong to enforce C4668 as an error on third party libs. Up to you guys.

Some "off by default" warnings are more useful than others. In my DirectXMath test suite I use /Wall, but disable a few off-by-default ones explicitly. In particular, you really need to disable these three as they are more 'informational' than actually warnings.

// Off by default warnings
#pragma warning(disable : 4514 4668 4820)
// C4514 'function' : unreferenced inline function has been removed 
// C4668 not defined as a preprocessor macro
// C4820 padding added after data member