What is __pragma and what are the differences between __pragma and #pragma(什么是 __pragma 以及 __pragma 和 #pragma 之间有什么区别)
问题描述
以下宏让我感到困惑.我想知道 __pragma 是什么,__pragma 和 #pragma 有什么区别.
The following macros confused me. I wondering what is __pragma and wwhat are the differences between __pragma and #pragma.
#define OPENVDB_START_THREADSAFE_STATIC_WRITE __pragma(warning(disable:1711))
#define OPENVDB_FINISH_THREADSAFE_STATIC_WRITE __pragma(warning(default:1711))
推荐答案
#pragma 本身就是一个预处理器指令;它不能在 #define 指令中使用.
#pragma is a preprocessor directive in its own right; it can't be used within a #define directive.
所以,这就是 __pragma 存在的原因:它提供了一种从使用它的宏展开的任何地方发出 pragma 的方法.
So, this is why __pragma exists: it provides a way for a pragma to be issued from wherever the macro that uses it is expanded.
这是一个非标准的编译器扩展(MSVC、Intel 和一些 C 编译器在不同程度上支持它).另请参阅在较新版本的 C/C++ 标准(以及用途相同,但语法略有不同).
This is a non-standard compiler extension (MSVC, Intel, and some C compilers support it to varying degrees). See also the _Pragma operator that is defined in newer versions of the C/C++ standards (and serves the same purpose, but with a slightly different syntax).
这篇关于什么是 __pragma 以及 __pragma 和 #pragma 之间有什么区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:什么是 __pragma 以及 __pragma 和 #pragma 之间有什么区别
基础教程推荐
- GDB 显示调用堆栈上函数地址的当前编译二进制文 2022-09-05
- 通过引用传递 C++ 迭代器有什么问题? 2022-01-01
- 我应该对 C++ 中的成员变量和函数参数使用相同的名称吗? 2021-01-01
- 为什么 RegOpenKeyEx() 在 Vista 64 位上返回错误代码 2021-01-01
- CString 到 char* 2021-01-01
- 为什么派生模板类不能访问基模板类的标识符? 2021-01-01
- 为什么 typeid.name() 使用 GCC 返回奇怪的字符以及如 2022-09-16
- 如果我为无符号变量分配负值会发生什么? 2022-01-01
- 初始化列表*参数*评估顺序 2021-01-01
- 非静态 const 成员,不能使用默认赋值运算符 2022-10-09
