Re: [PATCH] *(int*)0 = 0 & variations

Manfred Spraul (masp0008@stud.uni-sb.de)
Wed, 23 Jun 1999 23:39:12 +0200


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.
+ CONFIG_ASSERT so that if you need a multi line kassert(), you can do that
yourself
+ no VERIFY(), this only causes confusion and is ugly.
+ __kassert() that is always evaluated. This would replace BUG(),
PAGE_BUG(), *(int*)0 = 0, ... grep friendly and portable.
+ split show_registers() into show_stack() and the rest,
make show_stack() a public, portable, exported function.
(arch/alpha is implemented like this)

--
    Manfred

- 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/