home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / std / cplus / 1910 < prev    next >
Encoding:
Text File  |  1992-12-24  |  1.4 KB  |  28 lines

  1. Newsgroups: comp.std.c++
  2. Path: sparky!uunet!microsoft!hexnut!jimad
  3. From: jimad@microsoft.com (Jim Adcock)
  4. Subject: Re: Zero-length structures and pointer comparisons
  5. Message-ID: <1992Dec24.005848.1629@microsoft.com>
  6. Date: 24 Dec 92 00:58:48 GMT
  7. Organization: Microsoft Corporation
  8. References: <BzCG7K.2sG@frumious.uucp> <1992Dec18.192202.17023@ucc.su.OZ.AU> <9235622.25712@mulga.cs.mu.OZ.AU>
  9. Lines: 17
  10.  
  11. In article <9235622.25712@mulga.cs.mu.OZ.AU> fjh@munta.cs.mu.OZ.AU (Fergus James HENDERSON) writes:
  12. |A ptrcmp that always returned 0 would be useless, IMHO.
  13.  
  14. Such an implementation would allow people to write code that does the
  15. ptrcmp.  If the ptrcmp is zero, then the pointers could be compared.
  16. If the pointers didn't compare equal, then the invoking code would know
  17. that this machine doesn't support ptrcmp, and then the invoking code would
  18. fall back on a secondary, possibly slightly slower [but more globally 
  19. implementable] approach -- such as comparing object surrogates.
  20.  
  21. Thus such a ptrcmp would allow "optimal" performance on those systems
  22. that can reasonably implement a total ordering, and would allow near
  23. optimal performance on those machines that can't reasonably implement
  24. a total ordering.  Rather than insisting that those systems that can't
  25. reasonably implement ptrcmp do so anyway, or alternately not implement it
  26. at all, leading to "portable" code that isn't in practice portable anyway.
  27.  
  28.