home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c++
- Path: sparky!uunet!ornl!utkcs2!emory!swrinde!zaphod.mps.ohio-state.edu!saimiri.primate.wisc.edu!caen!spool.mu.edu!umn.edu!deci.cs.umn.edu!hansen
- From: hansen@deci.cs.umn.edu (David Hansen)
- Subject: Re: Is this a compiler bug?
- Message-ID: <1992Dec11.193023.27787@news2.cis.umn.edu>
- Sender: news@news2.cis.umn.edu (Usenet News Administration)
- Nntp-Posting-Host: deci.cs.umn.edu
- Organization: University of Minnesota
- References: <AC.92Dec6175233@ludwig.it.apollo.hp.com> <1992Dec8.183122.1@vax1.bham.ac.uk> <KANZE.92Dec11165414@slsvdnt.us-es.sel.de>
- Date: Fri, 11 Dec 1992 19:30:23 GMT
- Lines: 33
-
- In article <KANZE.92Dec11165414@slsvdnt.us-es.sel.de>, kanze@us-es.sel.de (James Kanze) writes:
- [..]
- |>
- |> If your compiler accepts this code, then it is broken. (I am
- |> supposing that NULL is defined as either 0 or 0L; however, in this
- |> case, nothing changes if it is defined as (void*)0.) "fptr" and the
- |> results of "(fptr = bar())" are both pointers to member functions, and
- |> *not* pointers. There is no implicit (nor explicit) cast from a
- |> pointer to member function to an int, a long, or a pointer, so it is
- |> not legal to compare a pointer to member function to NULL.
-
- Ummm, I don't think so. The ARM on p. 158 describes a possible implementation
- of pointers to member functions, and it explicitly describes a decision
- "To allow the representation of a null pointer to member to be 0..."
-
- Furthermore, on p. 161, the initialization of a pointer to member function
- to zero is given, thus:
-
- int (D::*pmf0)() = 0;
-
- which kind of implies the conversion of 0 to a pointer to member function
- does, indeed, exist.
-
- |>
- |> There is *no* special value for pointers to members, the equivalent to
- |> NULL for pointers. So if there are cases where "bar()" cannot return
- |> a legal value, some other arrangements must be made for it to return a
- |> status.
-
- There is no equivalent to void* for pointers to members -- see p. 70.
- Is this, perhaps, where the confusion might lie?
-
- -=Dave
-