home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c++
- Path: sparky!uunet!mcsun!julienas!jussieu!shiva.jussieu.fr!kriss
- From: kriss@blues.ibp.fr (Christophe GROSJEAN)
- Subject: Why not nested functions ?
- Message-ID: <KRISS.92Dec16162433@blues.ibp.fr>
- Keywords: nested functions, c++
- Sender: news@jussieu.fr (Le Facteur)
- Nntp-Posting-Host: blues.ibp.fr
- Reply-To: grosjean@masi.ibp.fr
- Organization: Laboratoire MASI, Paris, France.
- Distribution: comp
- Date: Wed, 16 Dec 1992 15:24:33 GMT
- Lines: 21
-
- Why nested functions are they not allowed in C++ ?
-
- There is many cases where they would be usefull.
-
- My point is that you can *simulate* nested functions using
- a local class. To call the function you call a member function
- of the local class, you explicitely give the syntaxic context
- you need for the function copying the automatic variables
- you want to use in local class members variables.
-
- In one word : I *do* it, so it can be done.
-
- Why is it not a C++ feature ? Adding it wouldn't change *anything*
- in todays working code (right now it is forbidden !).
- If it's an efficiency problem, so what... People who don't need it
- don't have to use it. People who need it should use it without having
- the trouble i have. I hav'nt found any other way than nested functions
- to provide a context to recursive iterators (that can't easily give control
- back to users after each element : no next() function available !).
-
- I'd appreciate to hear what you C++ lawyers have to say about it.
-