|
|
|
|
|
by lifthrasiir
989 days ago
|
|
> No one sane would mutate elements, free memory or throw exceptions in a sort comparison function. No one sane would intentionally do so, but we are not talking about that. The OP has a section that links to a blog post by Danila Kutenin, which mentions `std::sort` often just segfaults if a comparator doesn't satisfy irreflexivity or asymmetry, yet such comparators were found in the wild, even passing all reviews and even tests (!) because this behavior greatly depends on the number of elements. Given this occurrence of the actual bug in user comparators, it should be no surprise that they may also contain mutations, memory deallocations and exception throws (all of which can easily be a side effect from internal routines). |
|
It is great that rust can prevent them those additional issues, but in the grand scheme of things it is not something I lose sleep about.