lkml.org 
[lkml]   [1999]   [Jun]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] *(int*)0 = 0 & variations
Manfred Spraul wrote:
>
> From: adve@oce.nl (Arjan van de Ven):
> > #define kassert(cond) if (cond) ;
> >
> > That way,kassert(var++)works the same with and without
> > DEBUG. (I know, one shouldn't change a variable in an
> > assert, but there is NO decent way to find such bugs)
>
> I disagree:
> * all kassert() makros will be new, so we won't have a legacy code/
> overlooked change problem
> * is possible that kassert() calls functions which should only be called in
> debug, so "if(cond)" would be a slowdown.
> * [UGLY] we could add the VERIFY() macro, that's what Microsoft did in MFC.
>
> --> IMHO the best solution:
> + kassert() identical to the normal user mode assert(). It _does not_ oops.

Reading from my ANSI C reference:

assert checks the value of the given expression. If the expression is
false (zero), assert prints a message into the standard error stream
and
calls abort.

Looking at /usr/include/assert.h verifies this. assert() always calls
abort() and always has. It certainly makes sense to have an assert
macro that does not abort, but it is incorrect to claim that the normal
assert does not kill the program.

Jeff

-
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:3.560 / U:0.336 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site