I know th开发者_StackOverflowat #pragmas
are compiler directives which are used to provide additional information to the compiler. My question is that, I need to write some #pragmas
for my project. i.e, I need to invoke some particular code when there are some particular pattern in code. Can some one throw light on this ...?
Thanks in advance..!
You can't write your own #pragma
s. You must look into your compiler's handbook for which #pragma
s are supported.
Alternatively, if your compiler allows you to modify its source code (license- and sourcecode-wise), you might hack some new ones in. Don't expect it to be a trivial task, there's usually no enduser-friendly plug-in write-your-own-pragmas system.
#pragma
is a way for compiler vendors to legally implement proprietary extensions. They are hard-coded into the compiler. (And IIRC compilers are required to ignore unknown pragmas.)
Unless you write your own compiler, you cannot create your own pragmas.
精彩评论