开发者

Enforce compiler settings via macros

I am developing a framework which requires very strict compiler settings. Every time a new project is started and uses the framework, it must adhere to the settings (for example, warning level 4). I开发者_Go百科s there any way I can do that via macros and pragma statements? This will also allow me to do something like:

#ifndef NOT_USING_STRICT_SETTINGS
// All settings checks go here OR settings over-rides go here
#endif

This will benefit me as well in case I create a new project and forget to apply some settings.


You can get the list of predefined macros from MSDN: http://msdn.microsoft.com/en-us/library/b0084kay(v=vs.80).aspx

These macros also allow checking for compiler directives.

Example:

#define USING_STRICT_SETTINGS defined(_MT) && defined(_OPENMP)
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜