Archives
D Programming
DD.gnu digitalmars.D digitalmars.D.bugs digitalmars.D.dtl digitalmars.D.dwt digitalmars.D.announce digitalmars.D.learn digitalmars.D.debugger 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 |
c++ - Member Function Pointers and the Fastest Possible C++ Delegates
Below is an article I have written which may be of interest to many on this group: "Member Function Pointers and the Fastest Possible C++ Delegates" A comprehensive tutorial on member function pointers, and an implementation of delegates that generates only two ASM opcodes! http://www.codeproject.com/cpp/FastDelegate.asp It provides an in-depth exploration of exactly how each of the major compiler vendors implement member function pointers. Most of this has never been documented previously. Digital Mars comes out as a clear winner. Walter, you may be amused by the discussion of how badly Microsoft botched it :) This clandestine information is then used to create delegates similar to Borland C++'s __closure pointers or D delegates, that work on all C++ compilers in common use, and generate optimal asm code for most of them. (Unlike some other implementations, it also works for static function pointers). It is currently being used in commercial software on several different architectures, with several different compilers. The article has been extremely popular, and I know several people are using DMC after first hearing of it there. I'm doing my bit to advertise DMC! If you find any errors in the article (particularly in the compiler discussion), please let me know. -Don Jan 12 2005
Great article! In article <cs4u65$18ic$1 digitaldaemon.com>, Don Clugston says...Below is an article I have written which may be of interest to many on this group: "Member Function Pointers and the Fastest Possible C++ Delegates" A comprehensive tutorial on member function pointers, and an implementation of delegates that generates only two ASM opcodes! http://www.codeproject.com/cpp/FastDelegate.asp It provides an in-depth exploration of exactly how each of the major compiler vendors implement member function pointers. Most of this has never been documented previously. Digital Mars comes out as a clear winner. Walter, you may be amused by the discussion of how badly Microsoft botched it :) This clandestine information is then used to create delegates similar to Borland C++'s __closure pointers or D delegates, that work on all C++ compilers in common use, and generate optimal asm code for most of them. (Unlike some other implementations, it also works for static function pointers). It is currently being used in commercial software on several different architectures, with several different compilers. The article has been extremely popular, and I know several people are using DMC after first hearing of it there. I'm doing my bit to advertise DMC! If you find any errors in the article (particularly in the compiler discussion), please let me know. -Don Jan 12 2005
Um... Wow! I don't usually spend my time reading articles on C++, but that one was well worth the read. It wasn't just informative; it was well-written and non-cryptic -- a rare find in a high-tech world, especially in the C++ world. It certainly made me appreciate D, though. Thanks, Don. - John On Thu, 13 Jan 2005 04:41:41 +0000, Don Clugston wrote:Below is an article I have written which may be of interest to many on this group: "Member Function Pointers and the Fastest Possible C++ Delegates" A comprehensive tutorial on member function pointers, and an implementation of delegates that generates only two ASM opcodes! http://www.codeproject.com/cpp/FastDelegate.asp It provides an in-depth exploration of exactly how each of the major compiler vendors implement member function pointers. Most of this has never been documented previously. Digital Mars comes out as a clear winner. Walter, you may be amused by the discussion of how badly Microsoft botched it :) This clandestine information is then used to create delegates similar to Borland C++'s __closure pointers or D delegates, that work on all C++ compilers in common use, and generate optimal asm code for most of them. (Unlike some other implementations, it also works for static function pointers). It is currently being used in commercial software on several different architectures, with several different compilers. The article has been extremely popular, and I know several people are using DMC after first hearing of it there. I'm doing my bit to advertise DMC! If you find any errors in the article (particularly in the compiler discussion), please let me know. -Don Jan 14 2005
Um... Wow! I don't usually spend my time reading articles on C++, but that one was well worth the read. It wasn't just informative; it was well-written and non-cryptic -- a rare find in a high-tech world, especially in the C++ world. Jan 19 2005
It really is an excellent article. Thanks! Feb 26 2005
|