3 ms·
> For [1] I would say that when the compiler does not control the standard library (e.g. most linux systems) then the compiler should treat qsort like any norma
by jcranmer 5y ago
> For [1] I would say that when the compiler does not control the standard library (e.g. most linux systems) then the compiler should treat qsort like any normal non-libc function call, it shouldn't be able to detect that I might be relying on implementation-specific guarantees.
I am guessing, for example, that you are not aware that every compiler will optimize `printf("Hello, world!\n");` to `puts("Hello, world!\n");`. memcpy and memset are even more heavily-optimized function calls by the compiler: for example, they don't prevent memory-to-register promotion.
- dooglius 5y agoI am aware of these things, the rant by Ulrich Drepper on this breaking glibc guarantees [0] explicitly what I had in mind when writing that. [0] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=25609 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=25609