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
  • 相关阅读:
    二进制安全(学习笔记)
    rsa
    bugku 隐写 笔记
    dvwa随学笔记
    实验吧 密码学 writeup
    实验吧 隐写 writeup
    实验吧 web题weiteup
    Java数据结构和算法 第二版 课后习题第三章
    自动化测试入门指南(3)-- 入门demo
    自动化测试入门指南(2)-- 环境搭建
  • 原文地址:https://www.cnblogs.com/justin_s/p/2299370.html
Copyright © 2011-2022 走看看