VC++预定义宏(Predefined Macrod)

【Base系列】系统宏_M_IX86,_M_AMD64和_M_X64和MSVC预定义宏 分析 Date: 2019.04.18【Tag:基础知识】 Author: SoaringLee 系统宏_M_IX86,_M_AMD64和_M_X64和MSVC预定义宏 分析 阅读详情
 为了方便自己查询,从MSDN转载一份放在这里。

From:msdn.microsoft.com/en-us/library/b0084kay(VS.80).aspx

C/C++ Preprocessor Reference

Predefined Macros

Names the predefined ANSI C and Microsoft C++ implementation macros.

The compiler recognizes predefined ANSI C macros and the Microsoft C++ implementation provides several more. These macros take no arguments and cannot be redefined. Some of the predefined macros listed below are defined with multiple values. See the following tables for more information.

ANSI-Compliant Predefined Macros
MacroDescription

__DATE__

The compilation date of the current source file. The date is a string literal of the form Mmm dd yyyy. The month name Mmm is the same as for dates generated by the library function asctime declared in TIME.H.

__FILE__

The name of the current source file. __FILE__ expands to a string surrounded by double quotation marks. To ensure that the full path to the file is displayed, use /FC (Full Path of Source Code File in Diagnostics).

You can create your own wide string version of __FILE__ as follows:

#include <stdio.h>
#define WIDEN2(x) L ## x
#define WIDEN(x) WIDEN2(x)
#define __WFILE__ WIDEN(__FILE__)
wchar_t *pwsz = __WFILE__;

int main() {}

__LINE__

The line number in the current source file. The line number is a decimal integer constant. It can be altered with a #line directive.

__STDC__

Indicates full conformance with the ANSI C standard. Defined as the integer constant 1 only if the /Za compiler option is given and you are not compiling C++ code; otherwise is undefined.

__TIME__

The most recent compilation time of the current source file. The time is a string literal of the form hh:mm:ss.

__TIMESTAMP__

The date and time of the last modification of the current source file, expressed as a string literal in the form Ddd Mmm Date hh:mm:ss yyyy, where Ddd is the abbreviated day of the week and Date is an integer from 1 to 31.

Microsoft-Specific Predefined Macros
MacroDescription

_ATL_VER

Defines the ATL version.

_CHAR_UNSIGNED

Default char type is unsigned. Defined when /J is specified.

__CLR_VER

Defines the version of the common language runtime used when the application was compiled. The value returned will be in the following format:

Mmmbbbbb

where,

M is the major version of the runtime.

mm is the minor version of the runtime.

bbbbb is the build number.

// clr_ver.cpp
// compile with: /clr
using namespace System;
int main() {
   Console::WriteLine(__CLR_VER);
}

__cplusplus_cli

Defined when compiling with /clr, /clr:pure, or /clr:safe. Value of __cplusplus_cli is 200406. __cplusplus_cli is in effect throughout the translation unit.

// cplusplus_cli.cpp
// compile with: /clr
#include "stdio.h"
int main() {
   #ifdef __cplusplus_cli
      printf("%d\n", __cplusplus_cli);
   #else
      printf("not defined\n");
   #endif
}

__COUNTER__

Expands to an integer starting with 0 and incrementing by 1 every time it is used in a compiland. __COUNTER__ remembers its state when using precompiled headers. If the last __COUNTER__ value was 4 after building a precompiled header (PCH), it will start with 5 on each PCH use.

__COUNTER__ lets you generate unique variable names. You can use token pasting with a prefix to make a unique name. For example:

// pre_mac_counter.cpp
#include <stdio.h>
#define FUNC2(x,y) x##y
#define FUNC1(x,y) FUNC2(x,y)
#define FUNC(x) FUNC1(x,__COUNTER__)

int FUNC(my_unique_prefix);
int FUNC(my_unique_prefix);

int main() {
   my_unique_prefix0 = 0;
   printf_s("\n%d",my_unique_prefix0);
   my_unique_prefix0++;
   printf_s("\n%d",my_unique_prefix0);
}

__cplusplus

Defined for C++ programs only.

_CPPLIB_VER

Defined if you include any of the C++ Standard Library headers; reports which version of the Dinkumware header files are present.

_CPPRTTI

Defined for code compiled with /GR (Enable Run-Time Type Information).

_CPPUNWIND

Defined for code compiled with /GX (Enable Exception Handling).

_DEBUG

Defined when compiling with /LDd, /MDd, and /MTd.

_DLL

Defined when /MD or /MDd (Multithread DLL) is specified.

__FUNCDNAME__

Valid only within a function and returns the decorated name of the enclosing function (as a string). __FUNCDNAME__ is not expanded if you use the /EP or /P compiler option.

__FUNCSIG__

Valid only within a function and returns the signature of the enclosing function (as a string). __FUNCSIG__ is not expanded if you use the /EP or /P compiler option.

On a 64-bit operating system, the calling convention is __cdecl by default.

__FUNCTION__

Valid only within a function and returns the undecorated name of the enclosing function (as a string). __FUNCTION__ is not expanded if you use the /EP or /P compiler option.

_INTEGRAL_MAX_BITS

Reports the maximum size (in bits) for an integral type.

// integral_max_bits.cpp
#include <stdio.h>
int main() {
   printf("%d\n", _INTEGRAL_MAX_BITS);
}

_M_ALPHA

Defined for DEC ALPHA platforms (no longer supported).

_M_CEE

Defined for a compilation that uses any form of /clr (/clr:oldSyntax, /clr:safe, for example).

_M_CEE_PURE

Defined for a compilation that uses /clr:pure.

_M_CEE_SAFE

Defined for a compilation that uses /clr:safe.

_M_IX86

Defined for x86 processors. See Values for _M_IX86 for more details.

_M_IA64

Defined for Itanium Processor Family 64-bit processors.

_M_IX86_FP

Expands to a value indicating which /arch compiler option was used:

_M_MPPC

Defined for Power Macintosh platforms (no longer supported).

_M_MRX000

Defined for MIPS platforms (no longer supported).

_M_PPC

Defined for PowerPC platforms (no longer supported).

_M_X64

Defined for x64 processors.

_MANAGED

Defined to be 1 when /clr is specified.

_MFC_VER

Defines the MFC version. For example, 0x0700 represents MFC version 7.

_MSC_EXTENSIONS

This macro is defined when compiling with the /Ze compiler option (the default). Its value, when defined, is 1.

_MSC_VER

Reports the major and minor versions of the compiler. For example, 1310 for Microsoft Visual C++ .NET 2003. 1310 represents version 13 and a 1.0 point release. The Visual C++ 2005 compiler version is 1400.

Type cl /? at the command line to see the major and minor versions of your compiler along with the build number.

__MSVC_RUNTIME_CHECKS

Defined when one of the /RTC compiler options is specified.

_MT

Defined when /MD or /MDd (Multithreaded DLL) or /MT or /MTd (Multithreaded) is specified.

_NATIVE_WCHAR_T_DEFINED

Defined when /Zc:wchar_t is used.

_OPENMP

Defined when compiling with /openmp, returns an integer representing the date of the OpenMP specification implemented by Visual C++.

// _OPENMP_dir.cpp
// compile with: /openmp 
#include <stdio.h> 
int main() {
   printf("%d\n", _OPENMP);
}

_VC_NODEFAULTLIB

Defined when /Zl is used; see /Zl (Omit Default Library Name) for more information.

_WCHAR_T_DEFINED

Defined when /Zc:wchar_t is used or if wchar_t is defined in a system header file included in your project.

_WIN32

Defined for applications for Win32 and Win64. Always defined.

_WIN64

Defined for applications for Win64.

_Wp64

Defined when specifying /Wp64.

As shown in following table, the compiler generates a value for the preprocessor identifiers that reflect the processor option specified.

Values for _M_IX86
Option in Development EnvironmentCommand-Line OptionResulting Value

Blend

/GB

_M_IX86 = 600 (Default. Future compilers will emit a different value to reflect the dominant processor.)

Pentium

/G5

_M_IX86 = 500

Pentium Pro, Pentium II, and Pentium III

/G6

_M_IX86 = 600

80386

/G3

_M_IX86 = 300

80486

/G4

_M_IX86 = 400

Altium Designer (AD) 设计软件高频面试题及参考答案(3万字长文) 在Altium Designer(AD)中,设计复用是一种关键的策略,它允许设计师在多个项目中重复使用经过验证的设计元素,如原理图符号、PCB布局、元器件封装和设计规则集。在Altium Designer (AD) 中,手动布线和交互式布线是PCB设计中常见的两种布线模式,它们提供了设计师对布线路径的直接控制,特别是在处理复杂或关键信号路径时尤为有用。在Altium Designer (AD) 中进行电路级仿真是一项重要的设计验证步骤,它允许设计师在实际制造之前对电路的行为进行预测和分析。 阅读详情

相关推荐

STM32MP157+AD7606BSTZ四通道IEPE传感器采集方案实战(附完整电路图)

本文详细介绍了基于STM32MP157和AD7606BSTZ的四通道IEPE传感器采集方案,涵盖硬件电路设计、软件驱动开发及系统性能优化。通过精确的恒流源设计和同步采样技术,实现高精度振动信号采集,适用于工业振动监测等应用场景。

weixin_42713608的博客 702

宏_M_IX86,_M_AMD64和_M_X64

_M_IX86 : 32bit处理器_M_AMD64 : 64bit AMD处理器 (VC2008以前) _M_X64 : 64bit AMD处理器(VC2008及以后)_M_IX64 : 64bit Itanium处理器_WIN32 : Defined for both 32bit and 64bit processor_WIN64 : Defined for 64bit processorReferenceshttp://msdn.microsoft.com/en-us/library/b0084kay

程序员码工的专栏 1万+

ctf——writeup

ctf线上赛——第三关地址:http://106.75.86.18:2222提示:ip spoofing——ip伪造首先访问目标地址,一个正常的网页,挺文艺的。上面有些提示。根据上面的提示,我们浏览网页。找了好久,终于找到你。这个跳转链接。(在这个页面下方)我们接着点击这个链接,就跳转到administrator.php这个页面了。看到这个登录页面,就要知道用户名,密码,可是没有怎么办。一开始也试

Child_by_dream的博客 1320

C++预编译指令

C++预编译指令

liloqyqx的博客 1343

LangGraph的容错机制:从节点失败到图级回滚

核心概念铺垫:讲解LLM应用容错与事务性的核心概念(幂等性、重试策略、降级策略、快照、回滚、原子性、一致性、隔离性、持久性、最终一致性),对比LangGraph容错机制与传统数据库ACID事务、Apache Airflow/Kubernetes Workflow/Kubeflow Pipelines容错机制的异同;LangGraph容错机制的演进历史:用markdown表格梳理LangGraph从0.0.1到1.5.0(截止202X年X月)的容错机制发展历程;节点级别的容错:重试与降级。

AI Python 编程之道的博客 172

【网络】PFC背景和原理 、文档(DCB=PFC + ETS,DCBX=DCB扩展)

目录 零、背景 一、PFC 1.概述 2.报文格式 3.工作机制 二、ETS 产生原因 基本原理 优先级组的调度 优先级的调度 三、DCBX 产生原因 基本原理 DCBX TLV介绍 五、PFC 拥塞研究(文档收集) 六、DC-QCN算法 (网络工程师必会) 7.1 α更新 7.2 降速 7.3 提速 8.总结 ...

小鱼菜鸟的博客 2165

编译boost库出现"_M_IX86_FP错误

在将boost和我的程序生成的so动态库连接到mstar的UI后,发现编译出现错误: [Compiling ./utility/src/StoreModeManager.cpp] In file included from /home/chenweiqi/5_6586_ISDB/Supernova/projects/boost/boost/predef/hardware/simd.h:

u010943214的专栏 597

【BLE系列-第六篇】GATT解析:属性、特征、描述符的逻辑关系

本文系统介绍了BLE协议中的ATT和GATT机制。ATT以"属性"为基本数据单元,包含UUID、Handle、权限和Value四个要素。GATT则在ATT基础上构建了服务、特征和描述符的层次结构:服务(UUID:0x2800/0x2801)通过声明属性标识,特征声明(UUID:0x2803)指向特征值(UUID:0x2Axx或自定义),描述符(UUID:0x2900~0x290F)提供附加信息。GATT复用ATT发现机制,通过定义特定UUID语义实现服务发现和特征管理。这种设计使BLE设

qq_43399763的博客 1929

C/C++--跨平台--预定义宏 WIN32、_WIN32、_WIN64

只要包含了 Windows.h,那么 WIN32 常量是肯定定义了的,所以不能用于判断平台环境。只有64位程序才有,故此宏用来判断环境是 ×86 还是 ×64.32位和64位程序都有,且总是定义的.

qq_37233070的博客 2464

SRC漏洞挖掘实战:从攻击面管理到业务逻辑漏洞的精准狩猎

在网络安全领域,漏洞挖掘是识别和利用软件系统中安全弱点的核心实践。其基本原理在于通过系统化的方法,识别和评估一个应用或系统的攻击面,并从中定位安全防护的薄弱环节。这项技术的价值在于能够主动发现潜在风险,防患于未然,对于保障企业数字资产安全至关重要。典型的应用场景包括对Web应用、移动端API以及各类在线业务系统的安全性评估。在实际的漏洞挖掘,尤其是针对安全应急响应中心(SRC)的实战中,高效的策略往往聚焦于**边缘资产**的发现与利用,以及对**业务逻辑漏洞**的模式化测试。掌握这些经过验证的思路,能帮助安

babing2770的博客 414

kaggle学习笔记-餐厅数据挖掘

分析Zomato数据集的基本思想是为了公平地了解影响在班加罗尔不同地方建立不同类型餐厅的因素,每个餐厅的总评级,班加罗尔是这样一个城市,拥有超过12,000家餐厅,餐厅供应来自世界各地的菜肴。每天都有新的餐馆开业,这个行业还没有饱和,需求也在与日俱增。然而,尽管需求不断增加,新餐馆却很难与老牌餐馆竞争。大多数餐厅都供应同样的食物。班加罗尔是印度的IT之都。这里的大多数人主要依靠餐馆的食物,因为他们没有时间自己做饭。由于对餐馆的需求如此巨大,因此研究一个地方的人口统计学就变得很重要。

优快云XXCQ的博客 1862

编译器中和64位编程有关的预定义宏

本文对分别测试VC,MinGW,GCC 三种编译器,在32位和64位模式(共6种情况下),和64位编程有关的与预定义宏的值。对跨平台编程具有参考意义。

liangbch的专栏 2万+

AI自动化流程在金融风控中的3个典型案例

AI自动化风控流程全流程自动化:最小化人工干预,实现从数据输入到决策输出的闭环自适应学习:通过持续数据反馈实现模型自动迭代优化实时决策能力:满足毫秒级(支付风控)至分钟级(信贷审批)的响应需求多模态数据融合:整合结构化、非结构化和实时流数据智能决策解释:自动生成符合监管要求的决策解释人机协同机制:在高风险场景下实现AI与人类专家的协同决策实施后关键绩效指标(KPI)变化指标实施前实施后改进幅度平均审批时间3.2天4.7分钟-99.7%自动审批率15%85%+467%

架构师的AI之路,分享AI应用开发架构的学习与实践。 1535

GCC 预处理的宏 (predefined macros)

关于宏(macro) 在很早很早就知道, 但是只限于能看懂,在自己编程中从未使用。但是,在Powe8上将GATK HaplotypeCaller的GPU实现和SIMD实行并行处理的时候,遇到了很大的问题。找不到 g_compute_full_float() 函数的定义,因此开始觉得要认真整理一下思路。 1. 首先,编译器已经预定义了一些宏。 2.编译器自己预定一定的宏,在不同的参数下显示结构不...

jisuanji198509的博客 1621

VC中sqlite的使用

在VC中对sqlite的使用,实现数据库大批数据的快速插入,读取数据库中的数据在ListCtrl中显示

假人有限元模型

假人模型,车辆碰撞假人有限元模型,适合做乘员安全的研究者利用

使用gcc的预编译头文件

     vc的预编译头功能很强大,可以极大的提高编译效率,其实gcc也支持这项功能,设置更为简单。把所有外部文件都放到一个头文件里,比如predefine.h,所有引用外部文件的cpp文件都包含这个predefine.h就可以了。    首先要产生gch文件:    predefine.h.gch : predefine.h                $(cc) $(CFLAG) -x c+

一起去听海 3898

VB摄像头监控

该VB模块可对摄像头捕获的画面进行录像等,可在创建的窗口进行控制

c/c++内存泄漏检测工具(上)

1/  VC自带的CRT:_CrtCheckMemory   调试器和 CRT 调试堆函数 用法 /************************************************************************ *   环境:VC6.0 *   程序功能:CRT 检测内存泄漏      *   创建:  2014/3/20 * *   版本号:1.

我的E家 3086

OV9734 DATASHEET,完整规格书

OV9734完整规格书,包括电气参数,尺寸规格,寄存器配置表等

WIndows程序MFC控件使用Win7风格

1. 在stdafx.h中添加以下代码 #if defined _M_IX86 #pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyTok...

攻城狮的物联网基地 968

预处理器的预定义宏大全

符合ANSI的预定义宏:__DATE__:表示当前源文件编译时的日期,格式为:月/天/年(Mmm dd yyyy)。__FILE__:表示当前正在处理的源文件名称。__LINE__:表示当前正在处理的源文件的行,可以用#line指令修改。__STDC__:表示是ANSI C标准。只有在编译器选项指定了/Za,并且不是编译C++程序时,被定义为常整数1;否则未定义。__TIME__:表示当前源文件...

weixin_33866037的博客 347

C++预定义宏

很长一段时间在win下开发,把一些win下特有的宏和标准c++预定义宏混淆了。记录一下 参考链接:https://msdn.microsoft.com/zh-cn/library/b0084kay.aspx https://en.cppreference.com/w/cpp/preprocessor/replace   Visual c + + 编译器预定义某些预处理器宏,具体取决于语言 ...

lsfreeing的专栏 4235

预定义的宏

列出预定义的 ANSI C和C++ Microsoft实现宏。编译器识别预定义的ANSI C宏,并且Microsoft C++实现提供几个更多。 这些宏不带参数,并且不能重定义。下面列出的某些预定义的宏定义与多个值。 请参见下表。有关更多信息。ANSI兼容的预定义宏宏说明__DATE__当前源文件的生成日期。 Mmm dd yyyy." data-guid="c5cbce2c2fd28f54fe1

Augusdi的专栏 4568

c/c++标准预定义宏

C标准中的一些预定义宏 昨天写代码时需要在代码获取当前编译时间,从而可动态地作为版本信息,因此用到了C标准中的一些预定义的宏。在此将C标准中定义的几个宏一并总结一下: __DATE__ 进行预处理的日期(“Mmm dd yyyy”形式的字符串文字,如May 27 2006)  __FILE__ 代表当前源代码文件名的字符串文字 ,包含了详细路径,如G:/program/study/c

Qsir的专栏 2391

VC 宏与预处理使用方法总结(转)

作者:Breaker Zhao 转载请注明作者和原文链接

平凡者的专栏 2953
上一篇: C/C++的一些预定义宏
下一篇: C语言几种 预定义宏
Theodore_Lin
博客等级 码龄16年 24粉丝 5原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值