home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / lang / cplus / 17821 < prev    next >
Encoding:
Text File  |  1992-12-11  |  2.0 KB  |  46 lines

  1. Newsgroups: comp.lang.c++
  2. 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
  3. From: hansen@deci.cs.umn.edu (David Hansen)
  4. Subject: Re: Is this a compiler bug?
  5. Message-ID: <1992Dec11.193023.27787@news2.cis.umn.edu>
  6. Sender: news@news2.cis.umn.edu (Usenet News Administration)
  7. Nntp-Posting-Host: deci.cs.umn.edu
  8. Organization: University of Minnesota
  9. References: <AC.92Dec6175233@ludwig.it.apollo.hp.com> <1992Dec8.183122.1@vax1.bham.ac.uk> <KANZE.92Dec11165414@slsvdnt.us-es.sel.de>
  10. Date: Fri, 11 Dec 1992 19:30:23 GMT
  11. Lines: 33
  12.  
  13. In article <KANZE.92Dec11165414@slsvdnt.us-es.sel.de>, kanze@us-es.sel.de (James Kanze) writes:
  14. [..]
  15. |> 
  16. |> If your compiler accepts this code, then it is broken.  (I am
  17. |> supposing that NULL is defined as either 0 or 0L; however, in this
  18. |> case, nothing changes if it is defined as (void*)0.)  "fptr" and the
  19. |> results of "(fptr = bar())" are both pointers to member functions, and
  20. |> *not* pointers.  There is no implicit (nor explicit) cast from a
  21. |> pointer to member function to an int, a long, or a pointer, so it is
  22. |> not legal to compare a pointer to member function to NULL.
  23.  
  24. Ummm, I don't think so.  The ARM on p. 158 describes a possible implementation
  25. of pointers to member functions, and it explicitly describes a decision
  26. "To allow the representation of a null pointer to member to be 0..."
  27.  
  28. Furthermore, on p. 161, the initialization of a pointer to member function
  29. to zero is given, thus:
  30.  
  31.    int (D::*pmf0)() = 0;
  32.  
  33. which kind of implies the conversion of 0 to a pointer to member function
  34. does, indeed, exist.
  35.  
  36. |> 
  37. |> There is *no* special value for pointers to members, the equivalent to
  38. |> NULL for pointers.  So if there are cases where "bar()" cannot return
  39. |> a legal value, some other arrangements must be made for it to return a
  40. |> status.
  41.  
  42. There is no equivalent to void* for pointers to members -- see p. 70.
  43. Is this, perhaps, where the confusion might lie?
  44.  
  45.                     -=Dave
  46.