[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] BUG_ON() vs ASSERT()
> -----Original Message----- > From: Xen-devel [mailto:xen-devel-bounces@xxxxxxxxxxxxx] On Behalf Of Jan > Beulich > Sent: 12 September 2016 16:24 > To: xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx> > Subject: [Xen-devel] BUG_ON() vs ASSERT() > > All, > > in > https://lists.xenproject.org/archives/html/xen-devel/2016- > 09/msg01201.html > and > https://lists.xenproject.org/archives/html/xen-devel/2016- > 09/msg01210.html > Andrew basically suggests that we should switch away from using > ASSERT() and over to BUG_ON() in perhaps quite broad a set of cases. And > honestly I'm not convinced of this: We've been adding quite a few ASSERT()s > over the last years with the aim of doing sanity checking in debug builds, > without adding overhead to non- debug builds. I can certainly see possible > cases where using > BUG_ON() to prevent further possible damage is appropriate, but I don't > think we should overdo here. > > Thanks for other's opinions, If there's a situation where code can survive a 'should not happen' then an ASSERT is good to catch the 'should not happen' when debugging, but being compiled out in production is fine. If the code is definitely not going to survive a 'should not happen' then I think a BUG_ON at the earliest opportunity is a good thing because it makes post mortem diagnosis much easier. Clearly this does have to be balanced against the cost of calculation of the subject of the BUG_ON though. Paul > Jan > > > _______________________________________________ > Xen-devel mailing list > Xen-devel@xxxxxxxxxxxxx > https://lists.xen.org/xen-devel _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx https://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |