Thread overview | |||||
---|---|---|---|---|---|
|
December 07, 2006 binary searches in phobos | ||||
---|---|---|---|---|
| ||||
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 Re: binary searches in phobos | ||||
---|---|---|---|---|
| ||||
Posted in reply to Karen Lanrap Attachments: | 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 Re: binary searches in phobos | ||||
---|---|---|---|---|
| ||||
Posted in reply to Karen Lanrap | 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 |
Copyright © 1999-2021 by the D Language Foundation