Pragma directives specify machine- or operating-specific compiler features. The __pragma keyword, which is specific to the Microsoft compiler, enables you to code pragma directives within macro definitions.
Also (same link):
The __pragma() Keyword
Microsoft specific
The compiler also supports the __pragma keyword, which has the same functionality as the #pragma directive, but can be used inline in a macro definition. The #pragma directive cannot be used in a macro definition because the compiler interprets the number sign character (‘#’) in the directive to be the stringizing operator (#).
ts syntax is
_Pragma (string-literal);
where string-literal can be either a normal or wide-character string literal. It is destringized, by replacing all \ with a single \ and all " with a ". The result is then processed as if it had appeared as the right hand side of a #pragma directive. For example,
_Pragma (“GCC dependency “parse.y””)
has the same effect as #pragma GCC dependency “parse.y”.
The same effect could be achieved using macros, for example
#define DO_PRAGMA(x) _Pragma (#x)
DO_PRAGMA (GCC dependency “parse.y”)
According to IBM tutorial:
The _Pragma operator is an alternative method of specifying #pragma directives. For example, the following two statements are equivalent:
#pragma comment(copyright, “IBM 2010”)
_Pragma(“comment(copyright, “IBM 2010”)”)
The string IBM 2010 is inserted into the C++ object file when the following code is compiled:
_Pragma(“comment(copyright, “IBM 2010”)”)
int main()
{
return 0;
}
参考 https://stackoverflow.com/questions/45477355/difference-between-pragma-and-pragma-in-c