home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / std / cplus / 1850 < prev    next >
Encoding:
Text File  |  1992-12-21  |  2.2 KB  |  57 lines

  1. Newsgroups: comp.std.c++
  2. Path: sparky!uunet!pmafire!news.dell.com!natinst.com!cs.utexas.edu!usc!rpi!batcomputer!munnari.oz.au!metro!extro.ucc.su.OZ.AU!maxtal
  3. From: maxtal@extro.ucc.su.OZ.AU (John MAX Skaller)
  4. Subject: Re: Zero-length structures and pointer comparisons
  5. Message-ID: <1992Dec18.192202.17023@ucc.su.OZ.AU>
  6. Sender: news@ucc.su.OZ.AU
  7. Nntp-Posting-Host: extro.ucc.su.oz.au
  8. Organization: MAXTAL P/L C/- University Computing Centre, Sydney
  9. References: <1992Dec9.133956.29659@lth.se> <1992Dec9.191606.5665@lucid.com> <BzCG7K.2sG@frumious.uucp>
  10. Date: Fri, 18 Dec 1992 19:22:02 GMT
  11. Lines: 44
  12.  
  13. In article <BzCG7K.2sG@frumious.uucp> pat@frumious.uucp (Patrick Smith) writes:
  14. >dag@seldon.control.lth.se (Dag Bruck) writes:
  15. >| Suggested semantics: for any pointers p and q:
  16. >|
  17. >|       p == q   <=>   ptrcmp(p,q) == 0
  18. >|
  19. >|       p != q   <=>   ptrcmp(p,q) != 0
  20. >|
  21. >|       if p < q is defined,  ptrcmp(p,q) < 0   <=>  p < q
  22. >
  23. >On the other hand, this might be fairly cheap, given that
  24. >we're already insisting on
  25. >
  26. >   p == q   =>   ptrcmp(p,q) == 0
  27. >
  28.  
  29.     I'm NOT agreeing with this at present. I reject any relationship
  30. between p ? q and ptrcmp. On some machines any such relationship
  31. might make ptrcmp unimplementable, and thus defeat the proposal completely.
  32. It is only Jims suggestion that ptrcmp might always return 0 that
  33. makes it possible to make its existence mandatory.
  34.  
  35. In fact, p==q iff objects equal is unimplementable on some machines.
  36. That is, even the existing ARM requirement is unworkable.
  37.  
  38. Consider that p < q is implementation defined, so it could mean
  39. almosty anything. It does not have to obey ANY rules, unless
  40. the pointers are into the same array.
  41.  
  42. As such tying < to ptrcmp, or any such function which requires
  43. a total order immediately makes the specification inconsistent,
  44. and thus it will have to be rejected.
  45.  
  46. Lets stop having 'wish lists' here and analyse the problem
  47. properly. The first thing we have to do is fix the
  48. unworkable requirement that p==q iff p,q point to same object.
  49.  
  50.  
  51.     
  52. -- 
  53. ;----------------------------------------------------------------------
  54.         JOHN (MAX) SKALLER,         maxtal@extro.ucc.su.oz.au
  55.     Maxtal Pty Ltd, 6 MacKay St ASHFIELD, NSW 2131, AUSTRALIA
  56. ;--------------- SCIENTIFIC AND ENGINEERING SOFTWARE ------------------
  57.