Thread (16 messages) flat view 16 messages, 3 authors, 2017-11-23

Re: [PATCH 0/3] Introduce BUG_ON(cond, msg) MACRO

From: Jeff King <hidden>
Date: 2017-11-22 23:39:11

On Wed, Nov 22, 2017 at 03:28:14PM -0800, Jonathan Nieder wrote:
quoted
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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help