Feature ideas
Fergus Henderson
fjh@cs.mu.OZ.AU
Fri Nov 8 02:28:00 GMT 2002
On 08-Nov-2002, Gareth Pearce <tilps@hotmail.com> wrote:
> and -Wdirect-infninte-recursion and -Wprobable-direct-infinite-recursion
>
> first one detects
>
> int blah(int a, int b) {
> ... no branches no early outs no modification of a or b ...
> return blah(a,b)
> }
We have implemented a warning which is similar to this in the Mercury
compiler, and it has proved useful. It is enabled by default and there
is no way to turn it off. It doesn't trigger very often, but when it
does, it invariably indicates a bug. I suspect it is most useful to
novice programmers who are more likely to make mistakes of this kind.
Recursion is much more common in Mercury than in C, so the benefit may
be less in C, but nevertheless I would still be favourably disposed to
including this warning in GNU C, provided the implementation of the warning
wasn't too complicated.
--
Fergus Henderson <fjh@cs.mu.oz.au> | "I have always known that the pursuit
The University of Melbourne | of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh> | -- the last words of T. S. Garp.
More information about the Gcc
mailing list