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