简体   繁体   English

什么是__pragma,__ pragma和#pragma有什么区别

[英]What is __pragma and what are the differences between __pragma and #pragma

The following macros confused me. 以下宏使我感到困惑。 I wondering what is __pragma and wwhat are the differences between __pragma and #pragma. 我想知道__pragma是什么,__ pragma和#pragma之间有什么区别。

#define OPENVDB_START_THREADSAFE_STATIC_WRITE       __pragma(warning(disable:1711))
#define OPENVDB_FINISH_THREADSAFE_STATIC_WRITE      __pragma(warning(default:1711))

#pragma is a preprocessor directive in its own right; #pragma本身就是一个预处理程序指令; it can't be used within a #define directive. 它不能在#define指令中使用。

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. 因此,这就是__pragma存在的原因:它提供了一种方法,可以从使用它的宏扩展到的任何地方发出该pragma。

This is a non-standard compiler extension (MSVC, Intel, and some C compilers support it to varying degrees). 这是一个非标准的编译器扩展(MSVC,Intel和某些C编译器在不同程度上支持它)。 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). 另请参见在C / C ++标准的较新版本中定义的_Pragma运算符 (具有相同的用途,但语法略有不同)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM