jhy
jhy

Reputation: 233

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.

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

Upvotes: 6

Views: 6733

Answers (1)

Cameron
Cameron

Reputation: 98736

#pragma is a preprocessor directive in its own right; it can't be used within a #define directive.

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.

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).

Upvotes: 15

Related Questions