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

  1. Newsgroups: comp.std.c++
  2. Path: sparky!uunet!microsoft!hexnut!jimad
  3. From: jimad@microsoft.com (Jim Adcock)
  4. Subject: Re: Zero-length structures and pointer comparisons
  5. Message-ID: <1992Dec11.231131.10956@microsoft.com>
  6. Date: 11 Dec 92 23:11:31 GMT
  7. Organization: Microsoft Corporation
  8. References: <9234423.15066@mulga.cs.mu.OZ.AU> <1992Dec10.121200.18889@ucc.su.OZ.AU> <9234601.10277@mulga.cs.mu.OZ.AU>
  9. Lines: 15
  10.  
  11. In article <9234601.10277@mulga.cs.mu.OZ.AU> fjh@munta.cs.mu.OZ.AU (Fergus James HENDERSON) writes:
  12. |Actually, nested functions can be handled quite transparently.
  13. |Gnu C handles pointers to nested functions by creating a "trampoline"
  14. |function on the stack, and using the address of the trampoline
  15. |function. When the trampoline function is called, all it does is push
  16. |the pointer to the stack frame, and then jump to original nested
  17. |function. This way, the nested function does receive a hidden stack
  18. |frame parameter, but you can use pass the address of the nested
  19. |function to any function such as qsort() that just expects a normal
  20. |function pointer, since the address which will be automatically
  21. |converted to the address of a newly-created trampoline.
  22.  
  23. So that taking the address of a nested function in different scopes
  24. causes differing trampolines to be created, and differing pointers returned?
  25.  
  26.