home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / std / cplus / 1861 < prev    next >
Encoding:
Text File  |  1992-12-21  |  2.8 KB  |  69 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.202043.20366@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: <BzCG7K.2sG@frumious.uucp> <1992Dec18.192202.17023@ucc.su.OZ.AU> <1992Dec18.204337.3084@lth.se>
  10. Date: Sat, 19 Dec 1992 20:20:43 GMT
  11. Lines: 56
  12.  
  13. In article <1992Dec18.204337.3084@lth.se> dag@bellman.control.lth.se (Dag Bruck) writes:
  14. >In <comp.std.c++> maxtal@extro.ucc.su.OZ.AU (John MAX Skaller) writes:
  15. >>
  16. >>In fact, p==q iff objects equal is unimplementable on some machines.
  17. >>That is, even the existing ARM requirement is unworkable.
  18. >
  19. >No, some machines are unworkable :-).
  20.  
  21. I wont disagree with your sentiments.
  22.  
  23. However, lets consider that Unix file names are 'pointers' to files,
  24. and that links are allowed.
  25.  
  26. Then the average program cant tell if two file names point to
  27. the same file or not, since computing the inode number is the only
  28. way to do that, and only super users can do this calculation.
  29. (Imagine I'm right even if this isnt the case. Is it the case?)
  30.  
  31. Would this make such a system 'unworkable'?
  32.  
  33. The issue is whether pointers must provide any more functionality
  34. than the ability to access an object, that is, whether object
  35. identity can be established by pointer comparisons.
  36. (A related issue is whether two pointers point INTO the same object,
  37. or one points into an object the other points to)
  38.  
  39. I suggest that whole classes of software can be written that 
  40. do not rely on the ability to test if two pointers refer
  41. to the same object or not, other types of software require
  42. this information.
  43.  
  44. Perhaps we can conceive two types of pointers, type 1 
  45. provides no comparisons at all, type 2 allows equality test.
  46.  
  47. Most of the code I've written uses type 1, and most uses
  48. of type 2 could be rewritten as type 1.
  49.  
  50. In those cases where type 2 pointers are desirable, it
  51. seems reasonable to restrict them to pointers
  52. to objects created directly by me, and not the operating
  53. system.
  54.  
  55. Thus I would like to see the ARM == rewritten so the
  56. results of == on externally derived or otherwise mangled
  57. pointers are implementation defined.
  58.  
  59. Thus, if you write non-strictly conforming programs for
  60. a linear address machine, I have no complaint 
  61. when your hacks dont work on my segmented machine because
  62. you are using 'implementation defined' features of C++.
  63.  
  64. -- 
  65. ;----------------------------------------------------------------------
  66.         JOHN (MAX) SKALLER,         maxtal@extro.ucc.su.oz.au
  67.     Maxtal Pty Ltd, 6 MacKay St ASHFIELD, NSW 2131, AUSTRALIA
  68. ;--------------- SCIENTIFIC AND ENGINEERING SOFTWARE ------------------
  69.