This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: forcing tail/sibling call optimization
- To: dewar at gnat dot com, fjh at cs dot mu dot oz dot au
- Subject: Re: forcing tail/sibling call optimization
- From: dewar at gnat dot com (Robert Dewar)
- Date: Sun, 26 Nov 2000 11:14:45 -0500 (EST)
- Cc: gcc at gcc dot gnu dot org
The formal definition seems quite reasonable here, but I must say
I dislike the syntax, and it is unnecessarily provocative, since
this really is not semantically a goto at all (e.g. the formal
denmotational semantics would have nothing to do with the semantics
of goto). Why not something like "tail return" or perhaps better
simply a compiler directive.
The real point here is that the semantics is identical to return. What
the declaration (in whatever form it exists) is doing is to say that
the semanjtics of execution will be undefined if there are any subsequent
references to local variables of the caller. That's *all* that needs to
be said semantically.
In Ada, one would provide this capability by simply having a pragma
e.g. pragma Tail_Return; which has no effect on the semantics of the
program if it is correct.