home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / std / cplus / 1851 < prev    next >
Encoding:
Text File  |  1992-12-21  |  2.4 KB  |  55 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: <1992Dec18.193554.18588@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: <1992Dec11.230534.10499@microsoft.com> <1992Dec15.162202.11231@ucc.su.OZ.AU> <1992Dec16.201044.2968@microsoft.com>
  10. Date: Fri, 18 Dec 1992 19:35:54 GMT
  11. Lines: 42
  12.  
  13. In article <1992Dec16.201044.2968@microsoft.com> jimad@microsoft.com (Jim Adcock) writes:
  14. >In article <1992Dec15.162202.11231@ucc.su.OZ.AU> maxtal@extro.ucc.su.OZ.AU (John MAX Skaller) writes:
  15. >|But Jim, it is not implementation defined, it is required that 
  16. >|pointers to the same object compare equal. It is therefore
  17. >|legal to have a function:
  18. >|
  19. >|    f(X* a, X*b) {
  20. >|    if(a==b) { /* special case, copy b object */ ... }
  21. >|    else *a+=*b;
  22. >|    }
  23. >|
  24. >However, if a strictly conforming implementation is presented with a 
  25. >non-strictly conforming program, such as a program that calls OS
  26. >virtual memory mapping adjustment routines, or programs that send
  27. >pointers off the ends of arrays, or programs who don't properly point
  28. >at objects that correspond to the types of objects they pretend to point
  29. >at .... in all such cases all bets are off.  
  30. >
  31.     I know what you are saying but dont see it.
  32. ARM p74:"two pointers to the same object compare equal".
  33. Any program for which this is not true cannot be conforming,
  34. neither strictly nor non-strictly, it is non-conforming, it is
  35. not in fact a C++ program.
  36.  
  37.     Or have I got this wrong?
  38.  
  39.     For this reason I think the ARM requirement is unworkable,
  40. and must be modified. The rule should state that pointers
  41. derived from the same object directly in the program must
  42. compare equal. Pointers obtained from the OS need not follow
  43. this rule, in that case it is implementation defined.
  44. This is the case for pointers way off the end of an array:
  45. it is implementation defined.
  46.  
  47.     (When I say 'derived' from the same object, I 
  48. am defering the exact definition :-)
  49.  
  50. -- 
  51. ;----------------------------------------------------------------------
  52.         JOHN (MAX) SKALLER,         maxtal@extro.ucc.su.oz.au
  53.     Maxtal Pty Ltd, 6 MacKay St ASHFIELD, NSW 2131, AUSTRALIA
  54. ;--------------- SCIENTIFIC AND ENGINEERING SOFTWARE ------------------
  55.