A fresh look at comparisons
Bruno Medeiros
brunodomedeiros+spam at com.gmail
Fri Apr 25 05:28:35 PDT 2008
Steven Schveighoffer wrote:
>
> The default opCmp today is:
>
> int opCmp(Object o) { return this !is o;}
>
It is not. For DMD 2.012, it is:
int opCmp(Object o)
{
// BUG: this prevents a compacting GC from working, needs to be fixed
//return cast(int)cast(void *)this - cast(int)cast(void *)o;
throw new Error(cast(string) ("need opCmp for class "
~ this.classinfo.name));
}
It's also the same in DMD 1.023 (except without the string cast).
--
Bruno Medeiros - MSc in CS/E student
http://www.prowiki.org/wiki4d/wiki.cgi?BrunoMedeiros#D
More information about the Digitalmars-d
mailing list