Linux-kernel mailing list archive 1999-25,: Re: [PATCH] *(int*)0 = 0 & variations

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

Jeff Garzik (jgarzik@pobox.com)
Wed, 23 Jun 1999 21:48:40 -0400

- Messages sorted by: [ date ][ thread ][ subject ][ author ]
- Next message: Khimenko Victor: "Re: why is the size of a directory always 1024b ?"
- Previous message: Dean Gaudet: "fd arrays (was Re: RFC: BSD system call revoke?)"
- Maybe in reply to: Riley Williams: "[PATCH] *(int*)0 = 0 & variations"
- Next in thread: Jeff Garzik: "Re: [PATCH] *(int*)0 = 0 & variations"

Riley Williams wrote:
> There is also the fact that by its nature, assertion checking makes
> most of the standard oops report redundant as, if kassertoops was to
> be used, the exact circumstances would be known in advance. It would
> therefore make more sense to have two separate oops functions, one to
> deal with the current oops events, and a second to deal with an oops
> caused by a kassertoops() call.

Maybe call panic() or similar, instead of oops-ing?

> Here's the corrected version:
[...]
> +#ifdef DEBUG

'DEBUG' is far too general. __USING_KASSERT?

> +#else
> +#define kassert(cond) (void) abs(cond)
> +#define kassertoops(cond) (void) abs(cond)
> +#endif

Any code depending on assert evaluating the condition is broken IMHO.
Doing so breaks an important feature of assert: it evaluates to nothing
when disabled. Your above example violates the principle of least
surprise; instead, it should be ((void)0)

Once it does that, please do submit it to the Upper Penguins. ;-)

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/

- Next message: Khimenko Victor: "Re: why is the size of a directory always 1024b ?"
- Previous message: Dean Gaudet: "fd arrays (was Re: RFC: BSD system call revoke?)"
- Maybe in reply to: Riley Williams: "[PATCH] *(int*)0 = 0 & variations"
- Next in thread: Jeff Garzik: "Re: [PATCH] *(int*)0 = 0 & variations"