What's the correct opEquals signature for structs?

bearophile bearophileHUGS at lycos.com
Tue Mar 13 17:19:25 PDT 2012


Alex R. Petersen:

> Most compilers implement booleans as native integers and narrow/expand 
> them when storing/loading to/from memory, so it's unlikely to matter at all.

If you have the int value 25, this is a true value, in C you are free to use it for its zero/nonzero quality. But if opEquals is required to return a bool, the value 25 has to become 1, this is not just a narrowing. This conversion requires one instruction, I think.

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list