max() in phobos, and English logic operators

David Qualls davidlqualls at yahoo.com
Thu Nov 9 07:50:39 PST 2006


== Quote from Bill Baxter (dnewsgroup at billbaxter.com)'s article

> But my point was just that the extra information is not
necessary for
> the macro version.  The intended meaning of max(x,0) is clear
enough to
> the reader, so the compiler should be able to handle it without
> complaining, too.
> --bb

EXACTLY!  I also think you (mostly) nailed it with

> About signed types, I think
>     auto c = max(a,b)
> should pick the same type for c that the compiler would pick for
>     auto c = a+b;

except I don't think max(10U , -1) should return -1 cast to an
unsigned!



More information about the Digitalmars-d-learn mailing list