|
Archives
D Programming
digitalmars.Ddigitalmars.D.bugs digitalmars.D.dtl digitalmars.D.ide digitalmars.D.dwt digitalmars.D.announce digitalmars.D.learn digitalmars.D.debugger D.gnu D C/C++ Programming
c++c++.announce c++.atl c++.beta c++.chat c++.command-line c++.dos c++.dos.16-bits c++.dos.32-bits c++.idde c++.mfc c++.rtl c++.stl c++.stl.hp c++.stl.port c++.stl.sgi c++.stlsoft c++.windows c++.windows.16-bits c++.windows.32-bits c++.wxwindows digitalmars.empire digitalmars.DMDScript electronics |
digitalmars.D - Follow-on question about delegates
OK, having thought a bit more about delegates, I now have another question. The ABI shows a delegate as consisting of a context ptr and a function ptr. The context ptr can be a class reference, ptr to struct, ptr to closure or ptr to stack frame. If you're passing one of these delegates into another function, how does the receiving function figure out what kind of context it's looking at? Each of these things will look different in memory. Also, structs at least don't have a header that can be used to disambiguate the situation. Thanks, Jerry Jun 09 2009
Jerry Quinn wrote:OK, having thought a bit more about delegates, I now have another question. The ABI shows a delegate as consisting of a context ptr and a function ptr. The context ptr can be a class reference, ptr to struct, ptr to closure or ptr to stack frame. If you're passing one of these delegates into another function, how does the receiving function figure out what kind of context it's looking at? Each of these things will look different in memory. Also, structs at least don't have a header that can be used to disambiguate the situation. Jun 09 2009
Hello Jerry,OK, having thought a bit more about delegates, I now have another question. The ABI shows a delegate as consisting of a context ptr and a function ptr. The context ptr can be a class reference, ptr to struct, ptr to closure or ptr to stack frame. If you're passing one of these delegates into another function, how does the receiving function figure out what kind of context it's looking at? Each of these things will look different in memory. Also, structs at least don't have a header that can be used to disambiguate the situation. Thanks, Jerry Jun 09 2009
Jerry Quinn wrote:OK, having thought a bit more about delegates, I now have another question. Jun 09 2009
|