12-02-2008, 12:59 PM
sparker Wrote:There is one significant difference between a pointer and an index: you can only compare pointers within the same aggregate object (or with NULL). So you can check if an integer index is within the range of an array, but given a pointer you can't check that the pointer is in a valid range (unless you invoke the undefined behaviour in ANSI C90 6.3.8).
...
Is this important? I suspect not very much in practice.
stephen
So do I. This concession was made only for segmented processor architectures which are rapidly disappearing, even in the embedded space. All modern architectures have a linear address space and use the same arithmetic for pointers and unsigned integers.
<t>Konrad Schwarz<br/>
Siemens AG<br/>
CT SE 2 (Corporate Technology, Software & Engineering - Embedded Systems)</t>
Siemens AG<br/>
CT SE 2 (Corporate Technology, Software & Engineering - Embedded Systems)</t>