Best way to compare primitive types

Henning Hasemann hhasemann at web.de
Tue May 8 09:30:15 PDT 2007


On Tue, 08 May 2007 09:43:28 -0300
Ary Manzana <ary at esperanto.org.ar> wrote:

> Maybe something like this:
> ---
> int opCmp(T other) {
>      return this.value > other ? 1 :
>          (this.value < other ? -1 : 0);
> }

I always write this as:

return this.value < other ? -1 : this.value > other;

Which is more leet (read unreadable) ,-)

Henning


More information about the Digitalmars-d-learn mailing list