Path: utzoo!attcan!uunet!taumet!mike From: mike@taumet.com (Michael S. Ball) Newsgroups: comp.lang.c++ Subject: Re: operator++() and testing 'this' Message-ID: <479@taumet.com> Date: 16 Oct 90 16:16:31 GMT References: <1990Oct14.224706.1934@nowhere.uucp> <58242@microsoft.UUCP> Reply-To: mike@taumet.UUCP (Michael S. Ball) Organization: Taumetric Corporation, San Diego Lines: 18 In article <58242@microsoft.UUCP> jimad@microsoft.UUCP (Jim ADCOCK) writes: >Good point. Embedded objects are another good example why C++ compilers >DO NOT typically support the (this==0) test to see if objects are on the >heap or not. I haven't seen a C++ compiler released in years that >supports this test. Correct me if you find a counter-example. The reason Try all cfront versions, Oregon C++, Turbo C++, Zortech (at least earlier versions). It's absolutely necessary if assignment to this is allowed. What has probably misled you is that it only works if you DO assign to this within the constructor. If you don't the compiler generates code to check for a zero value and allocate space for you, thus making the value non-zero by the time you get to the user code. Mike Ball TauMetric Corporation mike@taumet.com