vc中ASSERT()和VERIFY()有什么区别?

解决方案 »

  1.   

    1 ASSERT与VERIFY宏在Debug模式下作用基本一致,二者都对表达式的值进行计算,如果值为非0,则什么事也不做;如果值为0,则输出诊断信息。 
    2 ASSERT与VERIFY宏在Release模式下效果完全不一样。ASSERT不计算表达式的值,也不会输出诊断信息;VERIFY计算表达式的值,但不管值为0还是非0都不会输出诊断信息。
      

  2.   


    我看有些说法是,VERIFY在Release模式下,如果是0会输出诊断信息。
      

  3.   

    ms-help://MS.MSDNQTR.v80.chs/MS.MSDN.v80/MS.VisualStudio.v80.chs/dv_vclib/html/3e1ab4ee-cbc7-4290-a777-c92f42ce7b96.htmIn the Debug version of MFC, evaluates its argument.
     
    VERIFY(booleanExpression )
     
    Parameters
    booleanExpression
    Specifies an expression (including pointer values) that evaluates to nonzero or 0.Res
    If the result is 0, the macro prints a diagnostic message and halts the program. If the condition is nonzero, it does nothing.In the Release version of MFC, [color=#FF0000]VERIFY evaluates the expression but does not print or interrupt the program. For example, if the expression is a function call, the call will be made.[/color]
      

  4.   

    学习我正在使用《Csdn收音机》第一时间获取最新动态!