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

  1. Newsgroups: comp.std.c++
  2. Path: sparky!uunet!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: <1992Dec12.155417.2628@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: <1992Dec8.103218.27689@lth.se> <9234423.15066@mulga.cs.mu.OZ.AU> <1992Dec9.133956.29659@lth.se>
  10. Date: Sat, 12 Dec 1992 15:54:17 GMT
  11. Lines: 28
  12.  
  13. In article <1992Dec9.133956.29659@lth.se> dag@seldon.control.lth.se (Dag Bruck) writes:
  14. >In <comp.std.c++> fjh@munta.cs.mu.OZ.AU (Fergus James HENDERSON) writes:
  15. >>
  16. >>What I propose is that we define a *standard library function* which computes
  17. >>a total ordering on pointers.
  18. >>
  19. >>int compare_pointers(const void *, const void *);
  20. >>    /* Returns negative, zero, or positive in the same manner as strcmp().
  21. >>       Perhaps in the interests of tradition and unreadability it should
  22. >>       be called ptrcmp() instead of compare_pointers() :-) */
  23. >
  24. >Suggested semantics: for any pointers p and q:
  25. >
  26. >    p == q   <=>   ptrcmp(p,q) == 0
  27.  
  28.     Are you SURE you need this? Why should == and ptrcmp
  29. be in any way related? In particular, on the 8086 if
  30. ptrcmp was a bitwise compare it would yield a total order,
  31. but we would have
  32.  
  33.     p == q && ptrcmp(p,q) !=0
  34.  
  35.  
  36. -- 
  37. ;----------------------------------------------------------------------
  38.         JOHN (MAX) SKALLER,         maxtal@extro.ucc.su.oz.au
  39.     Maxtal Pty Ltd, 6 MacKay St ASHFIELD, NSW 2131, AUSTRALIA
  40. ;--------------- SCIENTIFIC AND ENGINEERING SOFTWARE ------------------
  41.