On 5/16/13 5:24 PM, luka8088 wrote:
Hello everyone.

Today I ran into a interesting issue. I wrote

   auto offset = text1.length - text2.length;

and in case text2 was longer then text1 I got something around 4294967291.

So I opened an issue:
http://d.puremagic.com/issues/show_bug.cgi?id=10093

I know that there is a perfectly valid reason for this behavior, and
that this behavior is not undefined, but it is unexpected, especially
because unsigned is never mentioned in the code. One solution that comes
to mind is changing length to signed, but that makes no sense because
length is never negative.

It makes sense if you don't want to have these subtle bugs in your programming language -.-

Reply via email to