Re: [Nbd] [PATCH 1/1] nbd-server: prefer assertions over if-then-exits
- To: Tuomas Räsänen <tuomasjjrasanen@...1258...>
- Cc: nbd-general@lists.sourceforge.net
- Subject: Re: [Nbd] [PATCH 1/1] nbd-server: prefer assertions over if-then-exits
- From: Wouter Verhelst <w@...112...>
- Date: Tue, 12 Mar 2013 09:19:30 +0100
- Message-id: <20130312081930.GB30422@...3...>
- In-reply-to: <20130311135805.GA10296@...1259...>
- References: <20130311135805.GA10296@...1259...>
On Mon, Mar 11, 2013 at 03:58:05PM +0200, Tuomas Räsänen wrote:
> Assertions imply programming invariants which must be fulfilled,
> otherwise there is a programming error.
>
> Regarding this commit, it's a programming error to pass NULL to
> append_serve(). And now it's explicitly stated with the assert(3)
> statement.
>
> If-then-exit -constructs could be interpreted as a valid and
> semantically meaningful code: "it's a feature of append_serve() to
> exit the process if NULL is passed", which does not make any sense. On
> the other hand, assert(s != NULL) makes it very clear that NULL must
> not be passed, or the contract will be terminated along with the
> process.
applied, thanks
> This commit is part of the desensitization treatment for author's
> assertion allergy.
*g* :-)
--
Copyshops should do vouchers. So that next time some bureaucracy requires you
to mail a form in triplicate, you can mail it just once, add a voucher, and
save on postage.
Reply to: