Re: Recursion



In article <3ii8stFld89eU2@xxxxxxxxxxxxxx>,
Jan Vorbrüggen <jvorbrueggen-not@xxxxxxxxxxx> wrote:

> >> So can someone tell me which F77 compilers de facto allow indirect
> >> recursion ?
> > g77
>
> But I would a lot of little things could effectively break that "de
> facto" working recursion. Put, say, a SAVEd local variable in one of
> the routines concerned, and things might work differently than you
> expect.

And some of the things that can break are far more subtle than that. I
will repeat advice I have given others on the subject, though it has
been a while.

I strongly advise against trying to use recursion with an f77 compiler
unless the compiler is *EXPLICITLY DOCUMENTED* to support recursion.
Note that heresy from comp.lang.fortran does not constitute explicit
documentation. Nor does experimentation. It is quite possible for
recursion to appear to work during testing, but fail in subtle ways in
the actual application.

People *HAVE* gotten in trouble, even after "verifying" by test that
recursion seemed to work. It is possible for the failures to just cause
incorrect results without necessarily giving other symptoms (though
admittedly, the most common symptoms are probably various forms of
crashing, which at least makes it clear that something is wrong). You
have been warned.

It is not fruitful to try to think of all the ways that things might
fail and test them all. This simply is not adequate substitute for an
explicit statement of support.

As noted by Mike Prager, specification that a compiler supports f90 or
later constitutes explicit documentation that the compiler supports
recursion (as long as the specification is that the compiler supports
f90 instead of just "some f90 features"). A lot of current f77 compilers
also support f90 or later, so this is a significant point today.

--
Richard Maine | Good judgment comes from experience;
email: my first.last at org.domain | experience comes from bad judgment.
org: nasa, domain: gov | -- Mark Twain
.



Relevant Pages

  • Re: Treeviews
    ... Yes, MF supports Recursion, local-storage, and MANY other extensions (so marked ... > if you have a Micro Focus cobol compiler, ... move 1 to tree-pointer ... > like wise, entry points are allowed, supported and well documented. ...
    (comp.lang.cobol)
  • Re: whats wrong with a pic ?
    ... They are just fine for an assembly programmer who is used to ... A lot of 8 and 16 bit MCU compilers don't have recursion switched on by ... While recursion is very seldom the right way to approach a problem on a small micro, the fact that recursion is not supported shows the processor is not well suited to C, since it is missing one or both of a proper return stack and a fast access data stack for local variables. ... These are not essential for making a C compiler (in the c.a.e. ...
    (comp.arch.embedded)
  • Re: Question: Overflow
    ... I know that this is probably compiler and implementation dependent and that this is a standard c discussion group but can someone point me in the right direction or just answer? ... It never reaches the printf in a because it always recurses before it gets to it, and it never reaches the printf in main because a never returns. ... I would suggest reading the chapters on recursion in your text book, including anything that mentions "mutually recursive functions" or "mutual recursion". ...
    (comp.lang.c)
  • Re: Statement on Schildt submitted to wikipedia today
    ... Walter Banks a écrit: ... maybe that's why no C compiler for it exists? ... stack, somewhere - perhaps Walter can elaborate ... > compilers recursion is aggressively handled in the data and control ...
    (comp.lang.c)
  • Re: Can we make recursive funcions "Inline" ?
    ... Can we make recursive functions inline and what will be its behavior ... what are possibilities that compiler will create inline definition ... call if the recursion goes deeper at runtime. ...
    (microsoft.public.vc.language)