Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!uunet!munnari!otc!mikem From: mikem@otc.OZ (Mike Mowbray) Newsgroups: comp.lang.c++ Subject: Re: Questions about C++ Message-ID: <134@otc.OZ> Date: Thu, 2-Jul-87 06:22:59 EDT Article-I.D.: otc.134 Posted: Thu Jul 2 06:22:59 1987 Date-Received: Sat, 4-Jul-87 06:11:24 EDT References: <227@nih-csl.UUCP> Distribution: comp Organization: O.T.C. Systems Development, Australia Lines: 27 In article <227@nih-csl.UUCP>, keith@nih-csl.UUCP (keith gorlen) says: > Summary: Suggested technique for testing the class of an object > has some problems. > > In article <131@otc.OZ>, mikem@otc.OZ (Mike Mowbray) writes: >> >> #define IS_TYPE(classtype,instance) ((instance)._vptr == ::classtype\ >> __vtbl) >> [ ... deleted ... ] >> //-------------------------------------------------------- > > This technique assumes that all instances of a class will have the > same vtbl address, which is not true unless you use the +e compiler > switch. > [ ... deleted ... ] > Since using the +e switch is such a pain, I wouldn't recommend this method. Agreed. (Don't know why I mentioned this dubious method at all - I just thought it was an interesting curiosity.) Mike Mowbray Systems Development Overseas Telecommunications Commission (Australia) UUCP: {seismo,mcvax}!otc.oz!mikem ACSnet: mikem@otc.oz