Re: [PATCH v2 1/3] git-compat-util: introduce BUG_IF_NOT() macro
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Mar 17, 2025, 22:33 UTC
- Message-ID
- <xmqqjz8n70dt.fsf@gitster.g>
- In-Reply-To
- <109060ccb8665c73aa0c4f73e3cbbddcd135bde4.1742107322.git.gitgitgadget@gmail.com>
"Elijah Newren via GitGitGadget" <gitgitgadget@gmail.com> writes:
Show 5 quoted lines
> From: Elijah Newren <newren@gmail.com> > > Create a BUG_IF_NOT() macro which is similar to assert(), but will not be > compiled out when NDEBUG is defined, and is thus safe to use even if its > argument has side-effects.
If this is meant to be "similar to" assert, let's not call it BUG_IF_NOT(). The point of BUG() is that the developer can mark the problem with something more than just a conditional, and it feels funny to call a facility that lacks that central feature with a name with BUG in it.
ASSERT(), safer_assert(), safe_assert(), sane_assert()?
The last one is in line with safe_istest() that is used on sane_ctype[] and sane_qsort(), with the intention to allow developers to write right code more easily than using the plain vanilla C.
Thanks.