开发者

How to write pragmas in C

开发者 https://www.devze.com 2023-03-23 12:57 出处:网络
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 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 #pragmas. You must look into your compiler's handbook for which #pragmas 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.

0

精彩评论

暂无评论...
验证码 换一张
取 消