Thread overview | |||||||
---|---|---|---|---|---|---|---|
|
January 13, 2005 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 |
January 13, 2005 Re: Member Function Pointers and the Fastest Possible C++ Delegates | ||||
---|---|---|---|---|
| ||||
Posted in reply to Don Clugston | 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 > > > |
January 14, 2005 Re: Member Function Pointers and the Fastest Possible C++ Delegates | ||||
---|---|---|---|---|
| ||||
Posted in reply to Don Clugston | 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
|
January 20, 2005 Re: Member Function Pointers and the Fastest Possible C++ Delegates | ||||
---|---|---|---|---|
| ||||
Posted in reply to John Reimer | >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. Thanks, John. High praise indeed. >It certainly made me appreciate D, though. The first draft of the article included the word "scandal" in the title ;-). I have a love-hate relationship with C++. There are so many things wrong with it, but it's still much better than the alternatives. D is rapidly closing the gap, though. My impression is: D is a cleaned-up C++ created by someone who understands C++. C# is a cleaned-up C++ created by people who don't understand C++. (And uses a virtual machine that's *less* powerful than the real machine it's running on??? (eg long double) You've got to be kidding). Unfortunately, Walter has a lot less influence than Microsoft. -Don >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 .. etc |
February 26, 2005 Re: Member Function Pointers and the Fastest Possible C++ Delegates | ||||
---|---|---|---|---|
| ||||
Posted in reply to Don Clugston | It really is an excellent article. Thanks! |
Copyright © 1999-2021 by the D Language Foundation