Article View: comp.std.c++
Article #146Re: Zero-length structures and pointer comparisons
From: Steve Clamage
Date: Fri, 11 Sep 1992 19:01
Date: Fri, 11 Sep 1992 19:01
27 lines
1307 bytes
1307 bytes
jbn@lulea.trab.se (Johan Bengtsson) writes: |pete@genghis.borland.com (Pete Becker) writes: |: 0x0000:0x0010 |: 0x0001:0x0000 |: |: These two addresses refer to the same memory location. Converting them to |: longs in the most obvious way produces these two values: |: |: 0x00000010 |: 0x00010000 |But can this really happen, if the rule "pointer arithmetic only |within an array" is adhered to? Shouldn't all pointers within an |array be based on the same segment? If you do non-normalized pointer arithmetic, the offset portion could be greater than 15 and still point within the array. This causes no problems for the hardware, which doesn't care whether pointers are normalized. The compiler must still arrange for pointer comparisons to come out right, such as by normalizing them first. -- Steve Clamage, TauMetric Corp, steve@taumet.com Vice Chair, ANSI C++ Committee, X3J16
Technical Details
Message-ID:
<1992Sep11.190134.4283@taumet.com>Path:
arc1-ca.pugleaf.net!sparky!uunet!taumet!steveReferences:
<1992Sep10.162906.14398@genghis.borland.com> <4950@holden.lulea.trab.se>Show Full Headers
Complete Article Headers
Newsgroups: comp.std.c++ Path: arc1-ca.pugleaf.net!sparky!uunet!taumet!steve From: steve@taumet.com (Steve Clamage) Subject: Re: Zero-length structures and pointer comparisons Message-ID: <1992Sep11.190134.4283@taumet.com> Organization: TauMetric Corporation References: <1992Sep10.162906.14398@genghis.borland.com> <4950@holden.lulea.trab.se> Date: Fri, 11 Sep 1992 19:01:34 GMT Lines: 27