zoukankan      html  css  js  c++  java
  • pragma warning push[.n] / pop [from msdn]

    Push and Pop

    The warning pragma also supports the following syntax.

    #pragma warning( push [ ,n ] )

    #pragma warning( pop )

    Where n represents a warning level (1 through 4).

    The pragma warning( push ) stores the current warning state for every warning. The pragma warning( push, n) stores the current state for every warning and sets the global warning level to n.

    The pragma warning( pop ) pops the last warning state pushed onto the stack. Any changes that you made to the warning state between push and pop are undone. Consider this example:

    #pragma warning( push )
    #pragma warning( disable : 4705 )
    #pragma warning( disable : 4706 )
    #pragma warning( disable : 4707 )
    // Some code
    #pragma warning( pop ) 
    

    At the end of this code, pop restores the state of every warning (includes 4705, 4706, and 4707) to what it was at the start of the code.

    When you write header files, you can use push and pop to guarantee that warning-state changes made by a user do not prevent the headers from compiling correctly. Use push at the start of the header and pop at the end. For example, if you have a header that does not compile cleanly at warning level 4, the following code would change the warning level to 3 and then restore the original warning level at the end of the header.

    #pragma warning( push, 3 )
    // Declarations/definitions
    #pragma warning( pop ) 
     
    即保存及恢复当前warning们的状态
     
    Ref: http://msdn.microsoft.com/en-us/library/2c8f766e.aspx
  • 相关阅读:
    以管理员权限运行程序?
    vb6 判断64位操作系统
    vb6动态创建webbrowser
    vb6中webbrowser控件树转换备忘
    vb6异步ADO操作
    sql compact 使用EF无法更新的问题?
    本地vbs调试快速显示输出
    c# 加密转载 备忘
    vb.net 动态调用api
    SharePoint List 查看器
  • 原文地址:https://www.cnblogs.com/justin_s/p/2299370.html
Copyright © 2011-2022 走看看