fbrereto
fbrereto

Reputation: 35935

MSVC's _M_X64 Predefined Macro Clarification

The documentation for MSVC's Predefined Macros state "_M_X64 [is] Defined for x64 processors." What does that mean, exactly? Will it be defined:

Specifically, I'm looking for a compiler switch for the former case, not the latter. Will _M_X64 suffice for that purpose?

Upvotes: 7

Views: 5694

Answers (2)

wifecooky
wifecooky

Reputation: 93

It means that you can type the code like this.

#ifdef _M_X64
#pragma comment(lib, "TEST64BIT.LIB")
#else
#pragma comment(lib, "TEST32BIT.LIB")
#endif

Upvotes: 1

Michael
Michael

Reputation: 55425

It means that _M_X64 is the target processor. It is what you are building for, not what you are building on.

Upvotes: 10

Related Questions