Skip to content

Replace assert(0) with abort()#1792

Merged
pd3 merged 1 commit into
samtools:developfrom
mp15:assert_to_abort
Jun 20, 2024
Merged

Replace assert(0) with abort()#1792
pd3 merged 1 commit into
samtools:developfrom
mp15:assert_to_abort

Conversation

@mp15

@mp15 mp15 commented Jun 20, 2024

Copy link
Copy Markdown
Member

Replaces assert(0) with abort(). This ensures no behaviour change except the check is now not skipped when NDEBUG is defined.
Fixes #1791

@jkbonfield

Copy link
Copy Markdown
Contributor

I see it calls exit(1) earlier. It ought to return rather than exit, but I haven't looked into what uses it and whether any code checks for errors.

@pd3

pd3 commented Jun 20, 2024

Copy link
Copy Markdown
Member

This would benefit from a review. It might be better to propagate some of these errors to the caller rather than exit. However, this is certainly better than what was there before. Thank you

@pd3 pd3 merged commit 61b922b into samtools:develop Jun 20, 2024
@mp15 mp15 deleted the assert_to_abort branch June 20, 2024 16:22
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.

assert(0) is bad practice

3 participants