Pointers - Is it safe to point to invalid memory?
Ali Çehreli
acehreli at yahoo.com
Sat Aug 16 23:21:59 UTC 2025
On 8/16/25 8:44 AM, Brother Bill wrote:
> Source: Programming in D book, page 432, chapter 68.8
> Quote: It is valid to point at the imaginary element one past the end of
> an array.
I am the author. I have no problem with that part of the book: The quote
is correct.
Both C and C++ explicitly state what I wrote above. That guarantee is
necessary so that looping over the elements of an array does not make
the program illegal just because the array may be sitting at the end of
an allocated page.
D does not reject that part of C's memory model.
Ali
More information about the Digitalmars-d-learn
mailing list