home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / std / cplus / 1863 < prev    next >
Encoding:
Text File  |  1992-12-21  |  2.3 KB  |  56 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: <1992Dec19.203705.21919@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> <5347@holden.lulea.trab.se>
  10. Date: Sat, 19 Dec 1992 20:37:05 GMT
  11. Lines: 43
  12.  
  13. In article <5347@holden.lulea.trab.se> jbn@lulea.trab.se (Johan Bengtsson) writes:
  14. >Dag Bruck (dag@seldon.control.lth.se) wrote:
  15. >:     p == q   <=>   ptrcmp(p,q) == 0
  16. >
  17. >:     p != q   <=>   ptrcmp(p,q) != 0
  18. >
  19. >:     ptrcmp(p,q) < 0   <=>   ptrcmp(q,p) > 0
  20. >
  21. >I think ptrcmp() is a good way to resolve this issue.
  22. >
  23. >There is only one possible remaining weakness (I think):
  24.  
  25.     I disagree, but anyhow ...
  26. >
  27. >Any environment that relies on pointer translation (swizzling) to
  28. >transport objects between executing processes will have difficulty
  29. >maintaining a common total ordering for the pointers (IDs) of
  30. >objects within those processes (Jim Adcock pointed this out).
  31. >Examples include OODBMS and distributed systems.  Code relying
  32. >on ptrcmp() may be unportable to those environments.
  33. >
  34. >Should those environments be required to (somehow) provide special
  35. >ptrcmp() functions, that look at some object ID (not memory address)?
  36. >What if a program uses more than one pointer swizzling scheme (e.g.
  37. >distributing some objects over communication channels, and storing other
  38. >objects in an OODBMS)?  Is it the users job to provide the ordering
  39. >between those different object spaces?
  40. >
  41. >Anyone have a good solution for this?
  42. >
  43.     Yes. First look at ==. It is already flawed. The rules
  44. must be rewritten so that == has the given semantics only
  45. in 'domestic' cases. The results of == can be implementation
  46. defined in any cases the pointers are not derived by
  47. 'ordinary' operations. That lets OODBMS off the hook.
  48.  
  49.     The same solution can be applied to ptrcmp now.
  50.  
  51. -- 
  52. ;----------------------------------------------------------------------
  53.         JOHN (MAX) SKALLER,         maxtal@extro.ucc.su.oz.au
  54.     Maxtal Pty Ltd, 6 MacKay St ASHFIELD, NSW 2131, AUSTRALIA
  55. ;--------------- SCIENTIFIC AND ENGINEERING SOFTWARE ------------------
  56.