GSL.assert: Assertions

GSL.assert:断言

 

  • Expects // precondition assertion. Currently placed in function bodies. Later, should be moved to declarations. // Expects(p) terminates the program unless p == true // Expect in under control of some options (enforcement, error message, alternatives to terminate)
    期望//前提条件断言。当前放置在函数体中。以后,应移到声明位置。// Expects(p)会终止程序,除非p == true  // Expect在某些选项(执行,错误消息,终止选项)的控制下
  • Ensures // postcondition assertion. Currently placed in function bodies. Later, should be moved to declarations.
    确保//后置条件断言。当前放置在函数体中。以后,应移至声明。

These assertions are currently macros (yuck!) and must appear in function definitions (only) pending standard committee decisions on contracts and assertion syntax. See the contract proposal; using the attribute syntax, for example, Expects(p) will become [[expects: p]].

这些断言当前是宏(糟糕!),并且必须出现在函数定义中(仅),以待标准委员会对合同和断言语法的决定。见合同建议书;使用属性语法,例如,Expects(p)将变为[[expects:p]]。

 


关注微信公众号【面向对象思考】轻松学习每一天!

面向对象开发,面向对象思考!

 

C++核心准则​GSL.assert:断言_C++