home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / lang / cplus / 18061 < prev    next >
Encoding:
Text File  |  1992-12-16  |  1.4 KB  |  36 lines

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