全部书籍

专业

应用 关于 Coach 登录 开始阅读

书籍暂未推出简体中文版——当前显示英文版。

Computer Science · 术语表

什么是 Precondition, postcondition, specification?

又称: precondition · postcondition · specification

Definition 12.1 University Computer Science — Year 1 · 第 12 章 — Program Correctness

A precondition is a condition on the inputs, and on the state, that a caller must ensure before calling a function. A postcondition is a condition relating the result and the final state to the inputs, which the function guarantees when it returns. The pair is the function’s specification: a contract, in which the function owes nothing to a caller who broke the precondition.

在原文中阅读 →