什么是__pragma,__ pragma和#pragma有什么区别 [英] What is __pragma and what are the differences between __pragma and #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
存在的原因:它提供了一种方法,可以从使用它的宏扩展到的任何地方发出杂音.
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 ++标准中定义的 _Pragma
运算符(具有相同的目的,但语法略有不同.
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有什么区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!