Thread overview
binary searches in phobos
Dec 07, 2006
Karen Lanrap
Dec 07, 2006
Thomas Kuehne
Dec 07, 2006
Andrey Khropov
December 07, 2006
At least the searches in phobos/internal/switch.d fail when the length of the searched list reaches int.max/2, because a signed shift is executed instead of an unsigned shift to compute the new "mid" index for checking.

Should this considered to be a bug---or as an academic detection only?
December 07, 2006
Karen Lanrap schrieb am 2006-12-07:
> At least the searches in phobos/internal/switch.d fail when the length of the searched list reaches int.max/2, because a signed shift is executed instead of an unsigned shift to compute the new "mid" index for checking.
>
> Should this considered to be a bug---or as an academic detection only?

I haven't takten a closer look, but using "int" instead of "size_t" is most likely a bug.

Please file all bugs, even if they might seem "academic only". Those are usualy the bugs that are hard to track down and often show up while porting or using generated code.

Thomas


December 07, 2006
Karen Lanrap wrote:

> At least the searches in phobos/internal/switch.d fail when the length of the searched list reaches int.max/2, because a signed shift is executed instead of an unsigned shift to compute the new "mid" index for checking.
> 
> Should this considered to be a bug---or as an academic detection only?

It's actually a very famous bug:

http://googleresearch.blogspot.com/2006/06/extra-extra-read-all-about-it-nearly. html

-- 
'non-optimal' is a politically correct term for s**t