home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.std.c++
- Path: sparky!uunet!think.com!sophists.com!lewis
- From: lewis@sophists.com (Lewis G. Pringle)
- Subject: Re: Zero-length structures and pointer comparisons
- Message-ID: <1992Nov10.185247.14128@sophists.com>
- Date: Tue, 10 Nov 1992 18:52:47 GMT
- References: <1992Oct28.184135.25475@ucc.su.OZ.AU> <1992Oct30.003946.10484@microsoft.com> <1992Nov4.080805.13496@jyu.fi>
- Organization: Sophist Solutions
- Lines: 35
-
- In article <1992Nov4.080805.13496@jyu.fi> sakkinen@jyu.fi (Markku Sakkinen) writes:
- ...
- >I would first like to return to a much more important, related problem,
- >which somebody brought up here rather recently.
- >Namely, there is nothing in the ARM explicitly saying that
- >p == q might not yield 1 even when p and q are pointing at two different
- >objects. This hole makes e.g. some standard idioms in Stroustrup's books
- >implementation dependent.
-
- I'd like to ask a related question.
-
- Given code like:
-
- char* start = new char [10];
- char* end = start+10;
- char* p = start;
-
- assert ((p >= start) && (p <= end)); // this is gauranteed by ANSI-C
- p += 10;
- assert ((p >= start) && (p <= end)); // this is gauranteed by ANSI-C
- p = start;
- p--;
- assert (! ((p >= start) && (p <= end))); // ???????
-
- Is the last assertion portable? ARM/ANSI-C References?
-
-
- LeWiS.
-
-
-
- --
- Reading peoples signatures is a real waste of time.
-
- lewis@sophists.com (Lewis Gordon Pringle, Jr.)
-