Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 26 Aug 2004 21:11:15 +0200
From:      "Poul-Henning Kamp" <phk@phk.freebsd.dk>
To:        Brian Fundakowski Feldman <green@FreeBSD.org>
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:  <64740.1093547475@critter.freebsd.dk>
In-Reply-To: Your message of "Thu, 26 Aug 2004 14:30:22 EDT." <20040826183022.GO77326@green.homeunix.org> 

next in thread | previous in thread | raw e-mail | index | archive | help
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.

Poul-Henning

-- 
Poul-Henning Kamp       | UNIX since Zilog Zeus 3.20
phk@FreeBSD.ORG         | TCP/IP since RFC 956
FreeBSD committer       | BSD since 4.3-tahoe    
Never attribute to malice what can adequately be explained by incompetence.



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