10 ms·
> Am I doing something wrong? Yes, you just compiled C code as C++. Actually write it as C++ (get rid of the void* mostly) and your program becomes a constant
by hermitdev 4y ago
> Am I doing something wrong?
Yes, you just compiled C code as C++. Actually write it as C++ (get rid of the void* mostly) and your program becomes a constant time evaluation: https://godbolt.org/z/5fedo8s5q https://godbolt.org/z/5fedo8s5q
- uecker 4y agoThis has nothing to do with C++: https://godbolt.org/z/zTe8jocsE https://godbolt.org/z/zTe8jocsE
- deleted 4y ago[deleted]
- adrianN 4y agoWell the whole point of the exercise was to see whether the C-version of qsort would be optimized in the same way as templated code when the compiler can see the whole thing instead of just the declaration. That's why I didn't write templated code.