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 之间有什么区别
				
        
 
            
        - 如何对自定义类的向量使用std::find()? 2022-11-07
 - 近似搜索的工作原理 2021-01-01
 - STL 中有 dereference_iterator 吗? 2022-01-01
 - 静态初始化顺序失败 2022-01-01
 - 与 int by int 相比,为什么执行 float by float 矩阵乘法更快? 2021-01-01
 - 从python回调到c++的选项 2022-11-16
 - 使用/clr 时出现 LNK2022 错误 2022-01-01
 - 一起使用 MPI 和 OpenCV 时出现分段错误 2022-01-01
 - Stroustrup 的 Simple_window.h 2022-01-01
 - C++ 协变模板 2021-01-01
 
						
						
						
						
						
				
				
				
				