Re: [PATCH 0/3] Introduce BUG_ON(cond, msg) MACRO
- From
Jeff King <peff@peff.net>
- Date
- Nov 22, 2017, 23:39 UTC
- Message-ID
- <20171122233905.GC8577@sigill>
- In-Reply-To
- <20171122232814.GH11671@aiede.mtv.corp.google.com>
On Wed, Nov 22, 2017 at 03:28:14PM -0800, Jonathan Nieder wrote:
Show 16 quoted lines
> > I do like human readable messages. But sometimes such a message just > > makes the code harder to read (and to write). E.g., is there any real > > value in: > > > > BUG_ON(!foo, "called bar() with a foo!"); > > > > over: > > > > assert(foo); > > I think you're hinting at wanting > > BUG_ON(!foo); > > which is something that the Linux kernel has (and which is not done in > this series).
Yes. I'd be fine having a single-argument BUG_ON() like that. But then, I'm not sure what it's buying us over assert().
I get why the kernel cannot use the default "dump core and exit" behavior of assert(), but that's basically what our BUG() does.
-Peff