Article View: comp.std.c++
Article #138Re: this == 0 for nonvirtual functions
From: Andrew Koenig
Date: Fri, 21 Aug 1992 14:30
Date: Fri, 21 Aug 1992 14:30
24 lines
1602 bytes
1602 bytes
Perhaps someone might like to try to construct an example of why it might actually be useful to allow this==0 in a member function. I've been away, so I've missed some messages, but so far the only justification I've seen is statement like `it seems like a good idea.' I find it hard to imagine why it would be useful. A member function that never looks at `this' could just as well be made static; one that actually uses `this' had better not be called with this==0. Thus it appears that the only useful cases are: 1. a function that actually checks if this==0 and does different things depending on the result, or 2. a function that looks at this only if one of its arguments has a particular value. Both of these cases seem contrived to me, to the extent that I would expect to be able to accomplish an equivalent thing more elegantly by other means. Can someone actually come with a useful example? -- --Andrew Koenig ark@europa.att.com
Technical Details
Message-ID:
<23512@alice.att.com>Path:
arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!linac!att!att!allegra!alice!arkReferences:
<1992Aug18.045605.14220@sunb10.cs.uiuc.edu> <1992Aug20.215455.17279@microsoft.com> <1992Aug21.044448.8282@sunb10.cs.uiuc.edu>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!linac!att!att!allegra!alice!ark From: ark@alice.att.com (Andrew Koenig) Newsgroups: comp.std.c++ Subject: Re: this == 0 for nonvirtual functions Keywords: this virtual function undefined Message-ID: <23512@alice.att.com> Date: 21 Aug 92 14:30:01 GMT Article-I.D.: alice.23512 References: <1992Aug18.045605.14220@sunb10.cs.uiuc.edu> <1992Aug20.215455.17279@microsoft.com> <1992Aug21.044448.8282@sunb10.cs.uiuc.edu> Reply-To: ark@alice.UUCP () Distribution: usa Organization: AT&T Bell Laboratories, Murray Hill NJ Lines: 24