home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / std / cplus / 1761 < prev    next >
Encoding:
Text File  |  1992-12-12  |  2.5 KB  |  64 lines

  1. Newsgroups: comp.std.c++
  2. Path: sparky!uunet!munnari.oz.au!metro!extro.ucc.su.OZ.AU!maxtal
  3. From: maxtal@extro.ucc.su.OZ.AU (John MAX Skaller)
  4. Subject: Re: Zero-length structures and pointer comparisons
  5. Message-ID: <1992Dec12.162211.5076@ucc.su.OZ.AU>
  6. Sender: news@ucc.su.OZ.AU
  7. Nntp-Posting-Host: extro.ucc.su.oz.au
  8. Organization: MAXTAL P/L C/- University Computing Centre, Sydney
  9. References: <9234601.10277@mulga.cs.mu.OZ.AU> <1992Dec11.231131.10956@microsoft.com> <24392@alice.att.com>
  10. Date: Sat, 12 Dec 1992 16:22:11 GMT
  11. Lines: 51
  12.  
  13. In article <24392@alice.att.com> ark@alice.UUCP () writes:
  14. >In article <1992Dec11.231131.10956@microsoft.com> jimad@microsoft.com (Jim Adcock) writes:
  15. >
  16. >> So that taking the address of a nested function in different scopes
  17. >> causes differing trampolines to be created, and differing pointers returned?
  18. >
  19. >It shouldn't need to do that.  At most one trampoline is ever necessary
  20. >for a given nested function during its lifetime, namely the one that
  21. >binds the lexically surrounding context that was current when the
  22. >block containing the definition of that function was entered.
  23.  
  24.     Are you saying that if I have a recursive function with a nested
  25. function in it, and store the address of the nested function in scope
  26. at the time of entering the n'th recursion into an array in slot n,
  27. then executing the j'th slot will access the n'th activation record
  28. and not the j'th one? (I.e. all the functions in the array
  29. access the most recent activation record?)
  30.  
  31. >
  32. >Moreover, that trampoline address is unique until the corresponding
  33. >function has gone out of scope, at which point the address is moot.
  34.  
  35.     Irrespective of how it is implemented, and even if
  36. taking the address of a nested function is allowed, I would like
  37. to see C++ allow nested functions.
  38.  
  39.     There are several levels to which this could be done:
  40.  
  41.     1) Same as non-nested function: no access to environment,
  42.     BUT the name is function local, also no address taking.
  43.  
  44.     2) Allow access to environment, but not taking address.
  45.  
  46.     3) Full hog: allow address taking.
  47.  
  48. One could also restricted nesting to one level.
  49.  
  50. Andrew,
  51. Would any of these be likely to be accepted by the committee?
  52. Do you personally favour nested functions?
  53. If not, why not?
  54. Anyone else? Anyone with GNU actually using them?
  55. Anyone hate them?
  56.  
  57.  
  58.  
  59. -- 
  60. ;----------------------------------------------------------------------
  61.         JOHN (MAX) SKALLER,         maxtal@extro.ucc.su.oz.au
  62.     Maxtal Pty Ltd, 6 MacKay St ASHFIELD, NSW 2131, AUSTRALIA
  63. ;--------------- SCIENTIFIC AND ENGINEERING SOFTWARE ------------------
  64.