home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / comp / std / cplus / 1534 < prev    next >
Encoding:
Text File  |  1992-11-10  |  1.4 KB  |  46 lines

  1. Newsgroups: comp.std.c++
  2. Path: sparky!uunet!think.com!sophists.com!lewis
  3. From: lewis@sophists.com (Lewis G. Pringle)
  4. Subject: Re: Zero-length structures and pointer comparisons
  5. Message-ID: <1992Nov10.185247.14128@sophists.com>
  6. Date: Tue, 10 Nov 1992 18:52:47 GMT
  7. References: <1992Oct28.184135.25475@ucc.su.OZ.AU> <1992Oct30.003946.10484@microsoft.com> <1992Nov4.080805.13496@jyu.fi>
  8. Organization: Sophist Solutions
  9. Lines: 35
  10.  
  11. In article <1992Nov4.080805.13496@jyu.fi> sakkinen@jyu.fi (Markku Sakkinen) writes:
  12. ...
  13. >I would first like to return to a much more important, related problem,
  14. >which somebody brought up here rather recently.
  15. >Namely, there is nothing in the ARM explicitly saying that
  16. >p == q  might not yield 1 even when p and q are pointing at two different
  17. >objects.  This hole makes e.g. some standard idioms in Stroustrup's books
  18. >implementation dependent.
  19.  
  20. I'd like to ask a related question.
  21.  
  22. Given code like:
  23.  
  24. char* start = new char [10];
  25. char* end   = start+10;
  26. char* p     = start;
  27.  
  28. assert ((p >= start) && (p <= end));        // this is gauranteed by ANSI-C
  29. p += 10;
  30. assert ((p >= start) && (p <= end));        // this is gauranteed by ANSI-C
  31. p = start;
  32. p--;
  33. assert (! ((p >= start) && (p <= end)));    // ???????
  34.  
  35. Is the last assertion portable? ARM/ANSI-C References?
  36.  
  37.  
  38.                 LeWiS.
  39.  
  40.  
  41.  
  42. -- 
  43. Reading peoples signatures is a real waste of time.
  44.  
  45. lewis@sophists.com                                  (Lewis Gordon Pringle, Jr.)
  46.