lkml.org 
[lkml]   [1999]   [Jun]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] *(int*)0 = 0 & variations
Riley Williams wrote:
> > kassert() is a nop in release builds...
>
> That appears to be a contested viewpoint. The current voting is 8
> people in favour of kassert always evaluating its arguments and 6 in
> favour of it not doing so if its disabled - and, as previously stated,
> I'm in the latter group.

Please make that 8.99 in favour of always evaluating the
argument... almost always.

Assertions should not have side effects -- if you write them right, GCC
will optimise away the expression anyway. (Ignore strings for the moment).

However sometimes you'd *really* like to not evaluate the argument:
occasions when you'd write `kassert (check_complex_condition ())' which
calls a slow, consistency-checking function.

If they're rare putting #ifndef NDEBUG arround those calls is probably
reasonable. Or just test:

kassert (defined_NDEBUG || check_complex_condition ());

enjoy,
-- Jamie


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:52    [W:0.028 / U:0.336 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site