Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > Advancing past the last element of an array

Thread Tools

Advancing past the last element of an array

Tim Rentsch
Posts: n/a
Kaz Kylheku <(E-Mail Removed)> writes:

> On 2009-12-28, Johannes Schaub (litb) <(E-Mail Removed)> wrote:
>>> When you're dealing with multidimensional arrays, the compiler can
>>> genearate code which assumes that no bounds are violated.
>>> So for instance if you have some machine instruction with, say, a 12 bit
>>> displacement field, and in the given situation, that bit field is wide
>>> enough to address a dimension of the array, then the compiler can just
>>> blindly generate that instrution, even if your program overflows the 12
>>> bit width.

>> There are exactly two valid values of object pointers: Either a byte in
>> memory, or a null pointer value - there is no dedicated past-the-end value.

> In C, there is a concept of pointer validity which takes into account
> /how/ that pointer was obtained. That information is not necessarily
> encoded in the pointer's run time value. (Remember, in C, type
> information is not also encoded in run-time values; that doesn't mean
> you can violate the type system and still have a well-defined program).
> Since the validity of a pointer includes how it was obtained,
> merely knowing where that pointer points is not enough of an assurance
> of correctness. [...]

Perhaps you would be so good as to tell the group in
which section(s) of which ISO document(s) this concept
is explained or described?
Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Calculating the address of the element past the end of the array C Programming 7 05-11-2009 06:21 PM
one past the last element of an array object C Programming 5 12-06-2006 02:31 PM
Ridiculous readInt() bug? Read-head not advancing far enough? Java 17 04-15-2005 10:12 AM
PC date/time randomly advancing notme Computer Support 1 02-11-2005 08:35 PM
advancing with the asp:datagrid Tim Smith ASP .Net 1 11-25-2003 07:51 PM