Switch ignores case (?)

ketmar via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Nov 23 13:44:33 PST 2016


On Wednesday, 23 November 2016 at 21:40:52 UTC, Steven 
Schveighoffer wrote:
> So the better way is to sort based on byte array, and just use 
> memcmp for everything.

i am not completely sure that this is really better. sorting and 
generating tables is done in glue layer, which can be different 
for different codegens. and `.compare` method, that is used for 
sorting strings may be used in other places too. by introducing 
something like `switchCompare()` we will add unnecessary 
complexity to the compiler, will make sort order less obvious, 
and won't really get significant speedup, as binary search 
doesn't really do alot of comparisons anyway.

i thing it is better to be fixed in druntime.


More information about the Digitalmars-d-learn mailing list