This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: [tree-ssa][rfc] plans for nested functions
- From: dewar at gnat dot com (Robert Dewar)
- To: gcc at gcc dot gnu dot org, rth at redhat dot com, torvalds at osdl dot org
- Date: Sat, 27 Sep 2003 18:14:37 -0400 (EDT)
- Subject: Re: [tree-ssa][rfc] plans for nested functions
> Why do you want to continue to support nested functions in the first
> place? They are an abomination, a gcc-specific extension, and nobody
> sane uses them (yeah, yeah, libobj, but I said _sane_).
There are of course strong arguments in favor of nested functions, and
some would say that any decent language includes them for good reasons.
I hardly think there is any need to repeat the arguments here, since
they should be familiar to anyone with a reasonable background in
language design. The arguments nbecome very strong of course in a
multi-threaded environment.
> Are there really any users that do not deserve to either be fixed
> or just shot in the head?
Certainly the implementation of Ada depends on support for nested
subprograms, since Ada is a language in which the use of nested
subprograms is fundamental.
As for the suggestion of removing them from C, that seems a pretty
drastic step. I suspect that would cause major headaches for a
lot of users, and yes, of course there are many legitimate uses of
nested function.
> Nested functions was one such idea. The
> implementation used to do bad things (icache flushes at run-time,
> for christ sake!).
A level of emotional concern leading to casual profanity seems a bit
extreme in a technical discussion! The trampoline approach is indeed
problematical, but does avoid what would otherwise be distributed
overhead for programmers not using this extension. Now that is
something that I would expect Linus to get upset over :-)
In fact we identify the relatively inefficient implementation
of nested functions as problematical in the Ada case., but there are
far more worthwhile targets of opportunity (e.g. efficient
arithmetic overflow checking).