Path: utzoo!utgpu!news-server.csri.toronto.edu!clyde.concordia.ca!mcgill-vision!snorkelwacker!mintaka!olivea!samsung!zaphod.mps.ohio-state.edu!wuarchive!uunet!taumet!mike From: mike@taumet.com (Michael S. Ball) Newsgroups: comp.lang.c++ Subject: Re: operator++() and testing 'this' Message-ID: <481@taumet.com> Date: 19 Oct 90 16:08:15 GMT References: <1990Oct14.224706.1934@nowhere.uucp> <58242@microsoft.UUCP> <479@taumet.com> <58351@microsoft.UUCP> Reply-To: mike@taumet.UUCP (Michael S. Ball) Organization: Taumetric Corporation, San Diego Lines: 25 In article <58351@microsoft.UUCP> jimad@microsoft.UUCP (Jim ADCOCK) writes: >In article <479@taumet.com> mike@taumet.UUCP (Michael S. Ball) writes: >Hm, I can't get my local copy of cfront to accept assignment to this >at all. What version are you referring to? I use cfront 2.0 >Okay, I stand corrected. The corrected statement then is: > >There does exist some compilers that support the (this==0) test -- >provided you also perform the assignment to this hack. I guess this >is a case where two wrongs *do* make a right! This is the definition in a number of manuals. Andy gave a complete rundown of the subject in a recent posting, so I won't repeat it here. It's NOT a way to determine if something is on the heap, but a tool to allow the user control over allocation. Thank goodness it's going to disappear. The only standard way to determine this is to overload operator new. Communicating between operator new and the constructor is left as an exercise for the reader. Even then someone could fake you out by using ::new or something similar. -Mike-