Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 26 Aug 2004 16:07:28 -0400
From:      Brian Fundakowski Feldman <green@FreeBSD.org>
To:        Poul-Henning Kamp <phk@phk.freebsd.dk>
Cc:        Roman Kurakin <rik@cronyx.ru>
Subject:   Re: cvs commit: src/sys/geom/concat g_concat.c src/sys/geom/label g_label.c src/sys/geom/mirror g_mirror.c src/sys/geom/raid3 g_raid3.c src/sys/geom/stripe g_stripe.c
Message-ID:  <20040826200728.GP77326@green.homeunix.org>
In-Reply-To: <64740.1093547475@critter.freebsd.dk>
References:  <20040826183022.GO77326@green.homeunix.org> <64740.1093547475@critter.freebsd.dk>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, Aug 26, 2004 at 09:11:15PM +0200, Poul-Henning Kamp wrote:
> In message <20040826183022.GO77326@green.homeunix.org>, Brian Fundakowski Feldm
> an writes:
> >> KASSERT(error == 0 && pp->sectorsize > 0 && pp->mediasize > 0, ("Buggy code."));
> >
> >I don't like that one bit.
> 
> Get used to it :-)
> 
> >KASSERT() should be reserved for serious
> >programming errors -- guarding against side cases that show major
> >error.
> 
> That KASSERT does guide against a major error on the part of the
> programmer.
> 
> In GEOM I have generously sprinkled KASSERTs for the very purpose
> of stopping programmer misunderstandings or attempts to be smart.
> The intent is that the programmer will find his bugs even during
> light testing and that the KASSERTs will help clarify the intentional
> use of APIs.
> 
> They have been very successful in this respect, and more will be
> added as I think them up.

Why in the world would you crash the machine when you don't have to?
I use KASSERT()s quite liberally, too, you know, but running into
crashes in half-finished kernel code that's in the tree -- as a user
-- is far inferior to running into errors and warnings that do not
halt the whole system.

-- 
Brian Fundakowski Feldman                           \'[ FreeBSD ]''''''''''\
  <> green@FreeBSD.org                               \  The Power to Serve! \
 Opinions expressed are my own.                       \,,,,,,,,,,,,,,,,,,,,,,\



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