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

  1. Newsgroups: comp.std.c++
  2. Path: sparky!uunet!munnari.oz.au!cs.mu.OZ.AU!munta.cs.mu.OZ.AU!fjh
  3. From: fjh@munta.cs.mu.OZ.AU (Fergus James HENDERSON)
  4. Subject: Re: Zero-length structures and pointer comparisons
  5. Message-ID: <9235623.26595@mulga.cs.mu.OZ.AU>
  6. Sender: news@cs.mu.OZ.AU
  7. Organization: Computer Science, University of Melbourne, Australia
  8. References: <1992Dec8.173855.18153@meaddata.com> <1992Dec10.121935.19315@ucc.su.OZ.AU> <KANZE.92Dec10171114@slsvdnt.us-es.sel.de> <1992Dec20.012551.11306@ucc.su.OZ.AU>
  9. Date: Mon, 21 Dec 1992 12:15:39 GMT
  10. Lines: 39
  11.  
  12. maxtal@extro.ucc.su.OZ.AU (John MAX Skaller) writes:
  13.  
  14. >kanze@us-es.sel.de (James Kanze) writes:
  15. >>As it should.  The ARM (and the upcoming ANSI standard) can only
  16. >>address what happens in the context of C++, not what happens to the
  17. >>pointer once the OS gets its hands on it.
  18. >
  19. >    No, this is not true IMHO. The ARM can and does explicitly
  20. >or implicitly say "implementation defined" where it means that.
  21. >When the ARM says "so and so will be the case" then it must
  22. >always be the case.
  23.  
  24. No. The ARM described a contract between implementations and programmers,
  25. such that IF the programmer abides by certain restrictions, then
  26. the program will produce certain behaviour. If the programmer does
  27. not abide by these restrictions, then the ARM does not guarantee anything
  28. about the behaviour of the program.
  29.  
  30. >>In the same way, I would understand the ARM to be saying that all
  31. >>pointers generated by a correct program to point to any object defined
  32. >>(including a dynamic definition by new) in C++ will compare equal.  If
  33. >>you give the pointer to the OS, and it gives it back to you, then any
  34. >>guarantees must be made by the OS, and not the C++ language.
  35. >
  36. >    I agree. But that is not the case. The ARM says different.
  37. >It absolutely requires pointers to the same object to compare
  38. >equal, without qualification. The system MUST ensure this
  39. >to classify as conforming.
  40.  
  41. This statement is NOT without qualification. Virtually the whole of the
  42. ARM is qualified by the caveat that if the program invokes undefined
  43. behaviour, then all bets are off. Since the ARM is a reference manual,
  44. not a standard, this caveat is implicit rather than explicit.
  45.  
  46. -- 
  47. Fergus Henderson             fjh@munta.cs.mu.OZ.AU      
  48. This .signature virus is a self-referential statement that is true - but 
  49. you will only be able to consistently believe it if you copy it to your own
  50. .signature file!
  51.