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

  1. Newsgroups: comp.std.c++
  2. Path: sparky!uunet!mcsun!news.funet.fi!network.jyu.fi!sakkinen
  3. From: sakkinen@jyu.fi (Markku Sakkinen)
  4. Subject: Re: Zero-length structures and pointer comparisons
  5. Message-ID: <1992Nov11.094404.7382@jyu.fi>
  6. Organization: University of Jyvaskyla, Finland
  7. References: <1992Oct30.003946.10484@microsoft.com> <1992Nov4.080805.13496@jyu.fi> <1992Nov10.185247.14128@sophists.com>
  8. Date: Wed, 11 Nov 1992 09:44:04 GMT
  9. Lines: 39
  10.  
  11. In article <1992Nov10.185247.14128@sophists.com> lewis@sophists.com (Lewis G. Pringle) writes:
  12. >In article <1992Nov4.080805.13496@jyu.fi> sakkinen@jyu.fi (Markku Sakkinen) writes:
  13. >...
  14. >>I would first like to return to a much more important, related problem,
  15. >>which somebody brought up here rather recently.
  16. >> ...
  17.  
  18. I am still waiting for an answer to that question.
  19. Nobody got a clue?
  20.  
  21. >I'd like to ask a related question.
  22. >
  23. >Given code like:
  24. >
  25. >char* start = new char [10];
  26. >char* end   = start+10;
  27. >char* p     = start;
  28. > ...
  29. >p = start;
  30. >p--;
  31. >assert (! ((p >= start) && (p <= end)));    // ???????
  32. >
  33. >Is the last assertion portable? ARM/ANSI-C References?
  34.  
  35. Certainly not portable.  The ARM (o. 72 - 73) says that 'p--' above
  36. is undefined;  I would suppose that an implementation is allowed
  37. even to abort the programme at that point.  Or, 'p > start' and
  38. 'p < start' might both yield true, and 'p >= start' and 'p <= start'
  39. both false.
  40.  
  41. ----------------------------------------------------------------------
  42. Markku Sakkinen (sakkinen@jytko.jyu.fi)
  43.        SAKKINEN@FINJYU.bitnet (alternative network address)
  44. Department of Computer Science and Information Systems
  45. University of Jyvaskyla (a's with umlauts)
  46. PL 35
  47. SF-40351 Jyvaskyla (umlauts again)
  48. Finland
  49. ----------------------------------------------------------------------
  50.