Subject: Re: soc zfs: VERIFY() -> assert()?
To: None <tech-kern@netbsd.org>
From: Martin Husemann <martin@duskware.de>
List: tech-kern
Date: 06/28/2007 20:56:14
On Thu, Jun 28, 2007 at 02:37:00PM -0400, Oliver Gould wrote:
> Solaris defines VERIFY(exp), which is equivalent to KASSERT(exp), but it
> is always tested (ie, even if DIAGNOSTIC is not set).  Is it okay to
> define VERIFY to be assert?

I'm not sure about Solaris, but it is pretty common to use ASSERT() to
evalutate the condition only if DIAGNOSTIC, and VERIFY() to evaluate the
condition always, but only print a message when DIAGNOSTIC. The difference
being side effects of evaluating the expression.

So my bet would be:

#ifdef DIAGNOSTIC
#define VERIFY(exp) KASSERT(exp)
#else
(void)exp
#endif

or something similar.

Martin