Nested Functions in C++

Gabriel Dos Reis gdr@cs.tamu.edu
Sat Oct 23 13:52:00 GMT 2004


Mark Mitchell <mark@codesourcery.com> writes:

| Steven L. Zook wrote:
| 
| >Are there plans for adding nested function support to C++?
| >
| No.
| 
| >Are there significant obstacles in the way of doing so?
| >
| Technically, it's only work.  But, the C++ maintainers (myself
| included) will probably not be keen on accepting such a patch.  We're
| generally of the opinion that adding extensions to C++ is a mistake,
| unless they go through the ISO standardization process first.

Here is my own opinion.
I don't see what is wrong with using member function of local classes
and being explicit about when a reference or a copy of local variable
is needed. I can see why one may have a crying need for it in C; in
C++, the expressive power it provides seems very much quite unnoticeable.

There were lots of new proposals this week, and when something akin to
nested functions/lambdas were mentioned, my impression was that they
weren't the features that would have support from the "main" players.

-- Gaby



More information about the Gcc mailing list