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

container, error: update error handling #1659

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

eriksjolund
Copy link
Contributor

@eriksjolund eriksjolund commented Feb 7, 2025

What is the preferred way to write a check that indicates that a failure is not expected and that such a failure would indicate a programming errror?

One way is to write assert() (but such a check is only active for an executable that was compiled with the debug option enabled)

For example:

  assert(err != NULL);
  assert(*err != NULL);

This is another way:

if (err == NULL || *err == NULL) {
  // programming error
  _exit(EXIT_FAILURE);
}

I prefer assert() slightly more.

@eriksjolund eriksjolund force-pushed the update-error-handling branch 2 times, most recently from 91ac6e4 to ec1b7b3 Compare February 7, 2025 10:14
@eriksjolund eriksjolund force-pushed the update-error-handling branch from ec1b7b3 to b9e033d Compare February 7, 2025 12:04
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

Successfully merging this pull request may close these issues.

1 participant