4

Possible Duplicate:
A question about virtual mechanism in C++

Every time a question comes up about C++ and virtual function implementation, it's necessary to add a disclaimer that the C++ standard doesn't mandate that they be implemented with a class-wide static vtable and a pointer to the vtable. This is such a natural and fast method that I've never heard of it being done any other way, making the disclaimer somewhat pedantic.

Is there an example of a C++ compiler that uses another method to do virtual functions?

Community
  • 1
  • 1
Mark Ransom
  • 299,747
  • 42
  • 398
  • 622
  • @awoodland, good link. That question is language-agnostic, and the single answer reflects that. I'm more interested specifically in C++. – Mark Ransom Apr 30 '12 at 18:12
  • The answers none-the-less also contain the bit of information you are looking for: no known C++ implementations use anything other than virtual pointers. To be honest, I doubt the claims of the alternate dynamic dispatch mechanism being more efficient than vtables, but I have no data to make a stronger statement. – David Rodríguez - dribeas Apr 30 '12 at 18:27
  • @DavidRodríguez-dribeas, my comment refers to a link in a comment that was deleted. The question marked as a duplicate has a lot of noise in it that doesn't answer the question except to say "I haven't seen one either", except for one small reference to Microsoft's C++/CLI at the bottom. – Mark Ransom Apr 30 '12 at 18:31
  • And to be clear I was specifically *not* asking about what methods might be used instead, unless there was a particular C++ compiler that used one. – Mark Ransom Apr 30 '12 at 18:36
  • @MarkRansom - the duplicate question is *"Are there any compilers which implement Virtual Mechanism in any other way other than the virtual pointer and virtual table mechanism?"* and every single one of the many answers from the 1.5 year period says "I'm not aware of any". I think that's a fair duplicate. – Flexo Apr 30 '12 at 20:28
  • @awoodland, the phrasing of the question invited a lot of answers about other methods and other languages that are irrelevant noise. My question was trying to be very specific. You must have realized that or you wouldn't have deleted your first comment. – Mark Ransom Apr 30 '12 at 20:36
  • @MarkRansom - I didn't delete the one that linked to another more generic question than the one that was closed as a duplicate. I'm not sure where that one went, but I think it vanished at the same time as the auto inserted duplicate one. My original comment linking to [this question](http://stackoverflow.com/questions/7013737/alternatives-to-vtable), which was not the duplicate said something along the lines of "definitely not a duplicate". I'm wondering if it got auto clobbered by the duplicate closing cleanup/edit mechanism that inserted it as an edit. – Flexo Apr 30 '12 at 20:38

0 Answers0