This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/13005] Pointer wrongly adjusted for derived class containing virtual function


------- Additional Comments From stephenma at telus dot net  2004-01-09 08:40 -------
Gabriel Dos Reis wrote:

> | If the ARM did not mean to imply what I said it implied, then why
> | was it so consistent in apparently implying it -- at least twice?
> 
> Saying twice it implies, does not actually make it do so. 

The ARM never explicitly says that "1+1 == 2" is a C++ expression that
evaluates to 1, yet everyone knows it is so.  The standard
mathematical properties are assumed (absent overflow).

My point: when the implications are unambiguous and clear, they are
just as important and just as valid as the explicit statements.


> You probably realized that the problem was more acute for multiple
> inheritance -- and at the time, multiple inheritance was most  probably
> one of the "feature" people happen to pick on.

I can certainly imagine the loudness of the complaints from those who
wanted multiple inheritance to work.  (Personally, I avoid multiple
inheritance like the plague.)  Overall, the g++ people have done well.


> | The only answer is that the authors were blessing the universal
> | practice of the time, namely, that a base would always be at offset
> | zero in a derived, when only single inheritance is involved.
> 
> I happen to work with one of the authors.

Do you want me to congratulate you or feel sorry for you?  Hopefully,
Stroustrup's influence hasn't damaged you too badly.  :)

Are you on the C++ committee?  If so, I appreciate the work you must
have put into it.  The committee has done a huge job cleaning up C++.


> He never implies to impose a Single True Object Model.

He may not have intended to completely prescribe all features of the
object layout.  But that is not the same as saying that the ARM is
absolutely silent on the subject.  My contention is that the ARM is
clear on at least one feature, namely the zero adjustment used in
casting between a base and a derived (in single inheritance).

Even if Stroustrup never intended to prescribe the zero adjustment,
it's too late to retract that feature from the ARM.


> GCC changed object model it adopted the new ABI since GCC-3.0.
> Any code hat relies on a particular preivous object model was broken
> since then.

That's true.  But as I said earlier, let's have some pity for the
maintainers of old ARM code, which is now broken.  The patch for
-Wcast-incomplete is offered in that spirit.

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13005


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]