From -2116808050213380998
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,6d5520f8ce526ad5
X-Google-Attributes: gidf78e5,public
From: Christopher Eltschka <celtschk@physik.tu-muenchen.de>
Subject: Re: Pointer to member function restriction in standard
Date: 2000/01/28
Message-ID: <38905F66.1645AA54@physik.tu-muenchen.de>#1/1
X-Deja-AN: 578344918
Content-Transfer-Encoding: 7bit
Approved: Fergus Henderson <fjh@cs.mu.oz.au>, moderator of comp.std.c++
References: <388CC286.B7848872@hotmail.com> <86l2rq$r0i@library2.airnews.net>
X-Accept-Language: German/Germany, de-DE, German, de, en
X-Authentication-Warning: mulga.cs.mu.OZ.AU: fjh set sender to devnull@stump.algebra.com using -f
Content-Type: text/plain; charset=us-ascii
X-Complaints-To: abuse@demon.net
X-Mail2News-Path: news.demon.net!mulga.cs.mu.oz.au
X-Trace: mail2news.demon.co.uk 948987538 mail2news:15633 mail2news mail2news.demon.co.uk
Organization: [posted via] Leibniz-Rechenzentrum, Muenchen (Germany)
X-Robomod: STUMP, ichudov@algebra.com (Igor Chudov)
Mime-Version: 1.0
Nntp-Posting-Date: 27 Jan 2000 15:14:41 GMT
Newsgroups: comp.std.c++

Bill Wade wrote:
> 
> Jim Cobban wrote in message <388CC286.B7848872@hotmail.com>...
> >Could someone please explain to me the rationale behind the restriction
> >documented in paragraph 3 of section 5.3.1 of the standard:
> >
> >"A pointer to member is only formed when an explicit & is used and ...
> 
> My first guess: the guy who got this into the standard had once written
> 
>    while(foo){...}
> 
> when he had intended
> 
>   while(foo()){...}
> 
> he couldn't change the rule for existing pointer types, but could change
> them for member pointers.
> 
> My second guess: for object (data) members there needs to be a way to
> disambiguate pointer-to-member, pointer-to-object, and object.  If m is a
> non-static data member of base then &base::m, &(base::m) and base::m mean
> three different things.  The standard is slightly simpler if the same rules
> apply to both function members and data members.

I think the problem is the use of the same operator& to provide
both object pointers and member pointers. If there had been
another operator, say operator&& (which currently would be
interpreted as taking the address of an address, which is
ill-formed), then there would be no problem in allowing
&&(base::m) or even &&m to generate a pointer to member, while
&(base::m) or &m would return a pointer to the object.

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html              ]




