C++17 cannot beat D surely

Vittorio Romeo via Digitalmars-d digitalmars-d at puremagic.com
Sun Jun 4 03:06:09 PDT 2017


Could someone clarify why the generated assembly for

void main() @nogc {
     import std.algorithm;
     enum a = [3, 1, 2, 0]; // inferred to be int[]
     enum b = sort(a);
     static assert(b[0] == 0);
}

is 1380 lines with ldc 1.3.0 (-O3 -release -betterC -flto=full)?
You can see the result on godbolt here:
https://godbolt.org/g/BNRnO9

It's kind of surprising compared to C++'s 2 lines:
https://godbolt.org/g/vXrxaY



More information about the Digitalmars-d mailing list