Comparing pointers in C and D

Paul Backus snarwin at gmail.com
Thu Feb 16 06:56:07 UTC 2023


On Thursday, 16 February 2023 at 06:46:16 UTC, Ali Çehreli wrote:
> On 2/15/23 22:28, Paul Backus wrote:
>
> > In C the addition itself is defined behavior (you are allowed
> to create
> > a pointer to "one past the end" of an object)
>
> To be pedantic, "one past" is always applied to "the last 
> element of the array object". My reaction was to the non-array 
> object in the code. :)

"For the purposes of these operators, a pointer to an object that 
is not an element of an array behaves the same as a pointer to 
the first element of an array of length one with the type of the 
object as its element type."

http://port70.net/~nsz/c/c11/n1570.html#6.5.6p7


More information about the Digitalmars-d mailing list