C++Now! 2012 slides

Jonathan M Davis jmdavisProg at gmx.com
Thu Jun 7 18:20:17 PDT 2012


On Friday, June 08, 2012 00:47:06 Peter Alexander wrote:
> On Thursday, 7 June 2012 at 22:08:10 UTC, Andrei Alexandrescu
> 
> wrote:
> > On 6/7/12 3:04 PM, Timon Gehr wrote:
> >> 'min' is not complicated.
> > 
> > I agree.
> 
> Then how come it has a bug where it doesn't work with
> user-defined types?

Because it wasn't properly tested for that. Anything can have a bug in it. 
It's true that the more complicated something is, the more likely it is that 
it's going to have bugs, but the fact that something has a bug doesn't 
necessarily mean that it's overly complicated.

I admit that it surprised me how complicated std.algorithm.min is, but I don't 
think that it's all that bad. That extra complication does allow it to handle 
comparing signed and unsigned types more correctly. It's just a matter of 
fixing this one bug and adding proper tests so that it doesn't break like this 
again. And there's already a pull request to fix that (though it appears that I 
forgot to put a comment for it in the bug):

https://github.com/D-Programming-Language/phobos/pull/612

- Jonathan M Davis


More information about the Digitalmars-d mailing list