Re: [PATCH 2/2] merge-ort: fix slightly overzealous assertion for rename-to-self
- From
Elijah Newren <newren@gmail.com>
- Date
- Mar 13, 2025, 06:22 UTC
- Message-ID
- <CABPp-BF7iTvqKFvuOZ5wZ3vZADjCvB63iKR-4D5+WeTxnZGThg@mail.gmail.com>
- In-Reply-To
- <xmqqr031x2gg.fsf@gitster.g>
On Wed, Mar 12, 2025 at 4:18 PM Junio C Hamano <gitster@pobox.com> wrote:
Show 11 quoted lines
> > Elijah Newren <newren@gmail.com> writes: > > > But it might be worth mentioning that having side-effects in > > assertions is a huge no-no, and I understand that when folks have to > > debug one of those (I had to in a separate project years ago which was > > kind of nasty), that they sometimes jump to the conclusion that > > assertions are bad. > > Yes, assert() invites such mistakes. Why not avoid them when there > are better alternatives like "if (condition) BUG()"?
I mean, I just gave my reasons above which you snipped out. But if you feel it is important for folks to move away from assert(), would you like to see someone create a better alternative to assert, such as BUG_ON(condition), so that they have reason to want to switch?