Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

Why is it best to use Expects () to express prerequisites in C++

Shulou Source: shulou.com Published: 2022-06-01 20:33:43 10月04日 Update

This article mainly explains why it is best to use Expects () to express the prerequisite in C++. The content of the explanation in the article is simple and clear, and it is easy to learn and understand. Now please follow the editor's train of thought slowly and deeply, together to study and learn why it is best to use Expects () to express the prerequisite in C++.

I.6: Prefer Expects () for expressing preconditions expression prerequisite is better to use Expects ()

Reason (reason)

To make it clear that the condition is a precondition and to enable tool use.

This makes it more clear that the condition is a prerequisite and makes it available to the tool.

Example (sample)

Int area (int height, int width) {Expects (height > 0 & & width > 0); / / good if (height

Tags: Condition premise best Clearing language learning content variety tool suggestion situation way mode translator check original clear suspicious necessary necessary Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno MySQL MariaDB Linux Redmi OPPO Reno