Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 10 Mar 1999 20:34:52 +0100
From:      Poul-Henning Kamp <phk@critter.freebsd.dk>
To:        Matthew Dillon <dillon@apollo.backplane.com>
Cc:        Dag-Erling Smorgrav <des@flood.ping.uio.no>, sthaug@nethelp.no, dcs@newsguy.com, Jos.Backus@nl.origin-it.com, dima@tejblum.dnttm.rssi.ru, perhaps@yes.no, freebsd-current@FreeBSD.org
Subject:   Re: panic: zone: entry not free 
Message-ID:  <32857.921094492@critter.freebsd.dk>
In-Reply-To: Your message of "Wed, 10 Mar 1999 11:05:11 PST." <199903101905.LAA57081@apollo.backplane.com> 

next in thread | previous in thread | raw e-mail | index | archive | help

You two are  basically discussing "overspecifying source code" vs
"normal source code".  It doesn't really matter much if the
overspecifying consists of merging the TeX sources for a book or
by adding invariants as part of design verification.  The discussion
itself has about as much merit as our recent style(9) discussions,
split infinitives included or not:  It is pointless.

We already have one option in the kernel for "increased sanity
checks", it's called "DIAGNOSTIC" and it is legal to add (even
substantial) amounts of extra code under that option, as long as
there is a sensible reason.

Several of my kernels run with DIAGNOSTIC defined, and debug symbols
and basic-block profiling to boot.  And yes, I do find bugs that
way.  And no, I would hate to spend 50% of my performance on those
options in production.

Considering that I think a sensible approach here would be to define
a global macro called "INVARIANT(condition, text)" as follows:

#ifdef DIAGNOSTIC
#define INVARIANT(condition, text) if (condition) ; else panic(text)
#else
#define INVARIANT(condition, text) do ; while (0)
#endif

In a suitably global kernel include file.

Can everybody live with that as a compromise ?

--
Poul-Henning Kamp             FreeBSD coreteam member
phk@FreeBSD.ORG               "Real hackers run -current on their laptop."
FreeBSD -- It will take a long time before progress goes too far!


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?32857.921094492>