Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!decwrl!ucbvax!hplabs!hpda!hpcupt1!thomasw From: thomasw@hpcupt1.HP.COM (Thomas Wang) Newsgroups: comp.std.c++ Subject: Re: Casting within MI Graphs Message-ID: <52390001@hpcupt1.HP.COM> Date: 28 Aug 90 16:48:01 GMT References: <48168@brunix.UUCP> Organization: Hewlett Packard, Cupertino Lines: 27 / hpcupt1:comp.std.c++ / sdm@cs.brown.edu (Scott Meyers) / 12:23 pm Aug 27, 1990 / In article cline@sun.soe.clarkson.edu (Marshall Cline) writes: >Unfortunately, I don't have access to the C++ Report, but the commentary of >E&S outlines an implementation for virtual base classes that makes it >impossible to do downward casts such as I described, and I suspect this is >the implementation discussed in the C++ Report. As the discussion in E&S >implies, there are alternative implementations for virtual bases that allow >for well-defined downward casts, but they require more memory per object. The current C++ implementation of MI have yet another defect. The location of data members inside a virtual object is undefined until the object is initialized. This means that functions such as print_all_data_member(), when called during initialization phase, would segment fault because it would likely access address 0. The function mark_all_data_member(), and sweep_all_data_member() would not work when called during construction phase. These two subroutines are used to implement mark & sweep memory management. They will be called anytime memory is nearly exhausted. > Scott -Thomas Wang (Everything is an object.) wang@hpdmsjlm.cup.hp.com thomasw@hpcupt1.cup.hp.com