Article View: comp.std.c++
Article #1210Re: Zero-length structures and pointer comparisons
From: Jim Adcock
Date: Fri, 11 Dec 1992 23:11
Date: Fri, 11 Dec 1992 23:11
14 lines
1342 bytes
1342 bytes
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?
Technical Details
Message-ID:
<1992Dec11.231131.10956@microsoft.com>Path:
arc1-ca.pugleaf.net!sparky!uunet!microsoft!hexnut!jimadReferences:
<9234423.15066@mulga.cs.mu.OZ.AU> <1992Dec10.121200.18889@ucc.su.OZ.AU> <9234601.10277@mulga.cs.mu.OZ.AU>Show Full Headers
Complete Article Headers
Newsgroups: comp.std.c++ Path: arc1-ca.pugleaf.net!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