ProtoObject and comparison for equality and ordering
Mike Franklin
slavo5150 at yahoo.com
Wed May 15 00:23:15 UTC 2019
On Wednesday, 15 May 2019 at 00:08:10 UTC, Andrei Alexandrescu
wrote:
> This won't work because the result of opCmp is compared against
> zero. Using a floating point number is likely to be more
> efficient.
Please consider the fact that some microcontrollers don't have an
FPU. Some may have a software floating point implementation but
consider the cost in flash memory consumption and performance
implementing such a thing in software. It seems excessive.
Although it would be much more work, perhaps what is needed is a
new type (e.g. `struct CmpResult`) with 4 immutable instances
representing each result and an `opCmp` and `opEquals`
implementation that does the right thing comparing against 0 or
whatever else is needed. Yes, it's more complicated, but I think
it would scale better.
Mike
More information about the Digitalmars-d
mailing list