home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.std.c++
- Path: sparky!uunet!titan!lpi!pkt
- From: pkt@lpi.liant.com (Scott Turner)
- Subject: Re: pointer comparisons
- Message-ID: <1992Dec31.170223.21637@lpi.liant.com>
- Sender: pkt@lpi (Scott Turner)
- Organization: Liant Software Corporation
- References: <1992Dec27.050118.1628@lpi.liant.com> <1992Dec30.184614.5551@microsoft.com>
- Date: Thu, 31 Dec 1992 17:02:23 GMT
- Lines: 48
-
- In article <1992Dec30.184614.5551@microsoft.com> (Jim Adcock) writes:
- > Can you define your terms for us?
-
- > "distinct objects" means what?
- It means the objects are not identical.
-
- I was going to say that the standard for C++ needs to spell out what it
- means for object to be identical in a better way than just by
- 1. An object is a region of storage.
- 2. A definition or a new expression reserves the storage
- needed by the object.
- These two rules leave things much more loose than necessary when objects
- require no storage. But note that section 1.3 of the working paper
- (The C++ Memory Model) says:
-
- The constructs in a C++ program create, refer to, access, and
- manipulate objects in memory. Each object (except bit-fields)
- occupies one or more contiguous bytes.
-
- I missed this a while back when enumerating the features of the ARM and
- working paper which supported
- > The desired feature is:
- > Two pointers to the same type, which point to distinct objects
- > of that type, compare not equal.
- This excerpt from 1.3 gives the general rule I was seeking, because
- objects can be distinguished by the storage reserved for them.
-
- The excerpt may raise a few questions.
-
- How much freedom does it leave a compiler to optimize away
- an object's bytes (by application of the "as if" rule, etc.)?
- I think a good deal of freedom, because the working paper
- doesn't define the results if a program attempts to refer to
- or manipulate the bytes of an object.
-
- Does it govern base class subobjects? As I understand it,
- base class subobjects are objects, and hence are covered.
-
- Does it belong in the C++ standard? I'd say yes, given that
- compilers will for many practical purposes be able to
- optimize away unneeded bytes.
-
- --
- Prescott K. Turner, Jr.
- Liant Software Corp. (developers of LPI languages)
- 959 Concord St., Framingham, MA 01701 USA (508) 872-8700
- UUCP: uunet!lpi!pkt Internet: pkt@lpi.liant.com
-
-