Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 28 May 2018 11:07:59 -0700
From:      Ravi Pokala <rpokala@freebsd.org>
To:        Poul-Henning Kamp <phk@phk.freebsd.dk>, <arch@freebsd.org>
Subject:   Re: To assert() or not to assert(), that is not really a question...
Message-ID:  <4427091E-3B0E-4C34-B4C6-3557DD7B55E4@panasas.com>
In-Reply-To: <4514.1527319154@critter.freebsd.dk>
References:  <4514.1527319154@critter.freebsd.dk>

next in thread | previous in thread | raw e-mail | index | archive | help
-----Original Message-----
From: <owner-freebsd-arch@freebsd.org> on behalf of Poul-Henning Kamp <phk@phk.freebsd.dk>
Date: 2018-05-26, Saturday at 00:19
To: <arch@freebsd.org>
Subject: To assert() or not to assert(), that is not really a question...
> ...
> 
> 1. "Regular asserts" - things which are just plain wrong, which
>    probably means we have a genuine bug somewhere.  Examples could
>    be null pointers where previous checks should have ensured this
>    not be so.  Also error situations for which there is no saner
>    handling that killing the projcess.
> 
> ...
> 
> 3. "wrong asserts" - Internal state is messed up, program flow
>    has taken a "impossible" branch.  A good example is the
>    default branch of a switch on a finite input set.

Hi Poul-Henning,

I am in strong overall agreement with your argument. I am however confused as to how (1) and (3) are different; they're both irrevocably bad internal state.

Thanks,

Ravi (rpokala@)





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4427091E-3B0E-4C34-B4C6-3557DD7B55E4>