Re: [RFC PATCH] explicitly mark recursion count

From: Linus Torvalds
Date: Wed Jun 02 2004 - 09:46:46 EST




On Wed, 2 Jun 2004, Jörn Engel wrote:
>
> Then you see something I don't see. For example there are quite a few
> recursions with some function like
>
> void foo(int depth)
> {
> if (!depth) {
> bar(1);
> }
> ...
> }
>
> bar will, maybe through several more functions call foo(1).
>
> How can you say that foo will beak this recursion after two rounds
> max?

The programmer had _better_ know that there is some upper limit.

> I claim:
> There is no way to tell the depth of any recursion without looking at
> all involved functions.

And I claim: recursion is illegal unless the programmer has some explicit
recursion limiter. And if he has that recursion limiter in one of the
functions, then he damn well better know it, and know the value it limits
recursion to.

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