Tried C++ to D. Wrong result.
Dmitry
dmitry at indiedev.ru
Mon Nov 27 18:47:29 UTC 2017
On Monday, 27 November 2017 at 18:40:41 UTC, Ali Çehreli wrote:
> So, it looks like the original code was accessing out of bounds
> and probably that's why you inserted the ((index + 3) < N)
> check in the D version because D was catching that error at
> runtime.
Yes, it is.
> Which of course would skip the body of the if block, causing a
> difference from the original result.
Yes. I fixed it in C++ version also and now both versions works
same.
More information about the Digitalmars-d-learn
mailing list