Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assert Macro #4

Closed
jimin-kiim opened this issue Oct 20, 2022 · 0 comments
Closed

Assert Macro #4

jimin-kiim opened this issue Oct 20, 2022 · 0 comments

Comments

@jimin-kiim
Copy link
Owner

Assert Macro

  • ensuring the reliability of abstractions

Class invariant

  • every class might have conditions that must always be true inside an object.
  • by using assert(e), the condition to ensure that every member function code checks these conditions can be added.

assert(e)

  • used to implement programs that are more reliable.
  • can ensure that every member function code checks the condition that must be always true inside the object
  • debugging is time consuming. assertion helps finding the bugs save a lot of time when debugging.
  • #include <assert.h>
  • e: the condition that must always be true inside an object.
  • if e is true, just continue
  • if e is false, the program is stopped with an error message indicating the failure of the assertion
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant