Comparing pointers in C and D

Olivier Pisano olivier.pisano at laposte.net
Thu Feb 16 06:42:42 UTC 2023


On Thursday, 16 February 2023 at 06:37:54 UTC, Olivier Pisano 
wrote:
> If I change the variable types by arrays of 1 int, I get the 
> same result :
>
> https://godbolt.org/z/YWTvTPr4W
>
> You are right, it is certainly a UB, but it seems that the GCC 
> optimizer treats scalars and arrays the same way, as soon as it 
> can statically deduce the arithmetic goes past the end of the 
> object memory space.

And now I start wondering how can STL algorithms even work since 
the end iterator is past the last element. Gosh...


More information about the Digitalmars-d mailing list