Why does Object.opEquals *exist*

Bruno Medeiros brunodomedeiros+spam at com.gmail
Mon Nov 13 09:02:08 PST 2006


Stewart Gordon wrote:
> Anders F Björklund wrote:
>> Kristian Kilpi wrote:
>>
>>> So the original question remains: why 'opEquals' returns int?
>>
>> Walter says it is for performance reason, when e.g. sorting...
>>
>> http://www.digitalmars.com/d/archives/digitalmars/D/bugs/7933.html
> 
> I'm still not convinced that there's any way that opEquals can be made 
> more efficient by returning int instead of bool.
> 
> Stewart.
> 

Even more so due to the SETE instruction (which gcc uses) and makes 
converting to a bool after a comparison just as fast as getting an int. 
I wish Walter would comment on that, because, in the point that the 
discussion was left using a bool would be just as fast as an int, and I 
would like a lot of those functions like opEquals to return a bool.

-- 
Bruno Medeiros - MSc in CS/E student
http://www.prowiki.org/wiki4d/wiki.cgi?BrunoMedeiros#D



More information about the Digitalmars-d mailing list