Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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:

  • When I'm building for x64 processors, or
  • When I'm building with x64 processors?

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

like image 905
fbrereto Avatar asked Aug 28 '09 21:08

fbrereto


People also ask

What are the predefined macros?

Predefined Macros in C99 standard:It is used to test whether a header is compiled by a C compiler or a C++ compiler. This macro gives value similar to __STDC_VERSION__, in that it expands to a version number. __OBJC__ Macro:: __OBJC__ Macro has value 1 if the Objective-C compiler is in use.

Where is _M_X64 defined?

The _M_X64 macro is always defined by any of the compilers that generate x64 code. You simple use the 32-bit compiler to generate x86 code.

What is_ MSc_ ver?

Show activity on this post. _MSC_VER is (and always should be) defined when compiling with the Microsoft compiler so that it "evaluates to the major and minor number components of the compiler's version number".

What are predefined macros in C language?

Predefined MacrosA string containing the current date. A string containing the file name. An integer representing the current line number. If follows ANSI standard C, then the value is a nonzero integer.


1 Answers

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

like image 85
Michael Avatar answered Sep 20 '22 07:09

Michael