Comparing pointers in C and D

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


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.




More information about the Digitalmars-d mailing list