Xref: utzoo comp.lang.smalltalk:1863 comp.lang.misc:4867 Path: utzoo!utgpu!watserv1!watmath!att!cbnewsc!lgm From: lgm@cbnewsc.ATT.COM (lawrence.g.mayka) Newsgroups: comp.lang.smalltalk,comp.lang.misc Subject: Re: Languages that allow extensions to classes Message-ID: <15110@cbnewsc.ATT.COM> Date: 13 Apr 90 23:55:02 GMT References: <28835@cup.portal.com> Reply-To: lgm@cbnewsc.ATT.COM (lawrence.g.mayka,ihp,) Distribution: na Organization: AT&T Bell Laboratories Lines: 42 In article <28835@cup.portal.com> Rick_R_Kitts@cup.portal.com writes: > Adding a member function to a C++ class does not require recompilation >of other source files which access the class unless the size of the >class has changed (i.e. you added members). Also, unless you need to This understates the situation a bit. The following situations may require recompilation of other source files. - Adding a virtual function may not update the virtual function table (without additional recompilation). - Adding the first virtual function to a class may insert a new (hidden) member, the virtual function table pointer, thus changing the size of the class structure. - Adding a virtual function that precedes all others textually may cause the virtual function table pointer to occur at a different location within the class structure, effectively shuffling members. - Adding a virtual function anywhere other than at the end may shuffle the virtual function table entries and thus change the offset needed to call each virtual function. - Adding a member function may shadow an external function or type of the same name. - Adding a member function with an overloaded name may shadow (via the overloading rules) another member function overloaded on that same name. Those are the only cases I can think of *offhand*. In general, the C++ language assumes global consistency (i.e., global recompilation on any change to anything). Anything less may give implementation-dependent results. Lawrence G. Mayka AT&T Bell Laboratories lgm@ihlpf.att.com Standard disclaimer.