On Sun, Nov 5, 2017 at 9:15 PM, Konstantin Belousov <[email protected]>
wrote:
> On Sun, Nov 05, 2017 at 12:37:50PM -0700, Ian Lepore wrote:
> > IMO, the only reason ASSERT-style macros exist is to hide the
> > conditional-on-build-type part of the operation. That is, to avoid
> > having #ifdef INVARIANTS scattered everywhere.
> bde' point is that KASSERT() is badly designed, and I agree with him.
> Now we could at least remove the () around the message formatting part,
> but it is too late.
>
> >
> > Creating a macro to generate always-on error detection and reporting
> > code just because there exists a macro to do so conditionally seems to
> > turn the world on its head.
> I agree with this statement. if()panic(); construct is good enough, IMO.
>
I don't like our panic messages whatsoever, they are quite often not
informative.
For instance consider:
if (obj->foo < bar)
panic("bad foo %d, have fun looking for bar");
Instead a macro akin to PASS(obj->foo, <, bar, "obj %p", obj); can
expand itself to stringify the first 3 terms and also show the compared
values. Saves on boiler-plate written by hand.
I think *all* panics should be accompanied with a linux's oops-like dump.
I'm not volunteering for any of it though.
--
Mateusz Guzik <mjguzik gmail.com>
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[email protected]"