# Talk:qsort

WikiProject Computing (Rated Stub-class)
This article is within the scope of WikiProject Computing, a collaborative effort to improve the coverage of computers, computing, and information technology on Wikipedia. If you would like to participate, please visit the project page, where you can join the discussion and see a list of open tasks.
Stub  This article has been rated as Stub-Class on the project's quality scale.

## Example inefficient

Why are you promoting such an inefficient example? What about simply returning x-y?

Or remove the example, wikipedia isn't for learning programming? — Preceding unsigned comment added by 81.16.107.110 (talk) 08:07, 22 April 2017 (UTC)

## [Untitled]

Why does Qsort redirect here? Is there any disambiguation page of Qsort? 202.124.74.82 (talk) 06:34, 6 January 2010 (UTC)

Which pages did you have in mind for the disambiguation page? - Richfife (talk) 16:27, 6 January 2010 (UTC)

## arbitrary objects

It doesn't make sense to sort "arbitrary objects" since they don't have a natural ordering. The actual requirement is a set of objects with a strict weak ordering, but I don't know what to cite for that. McKay (talk) 07:00, 20 January 2014 (UTC)

`qsort` can sort arbitrary objects, as long as they have fixed size (or are addressed through pointers), because the ordering is entirely decoupled from the objects. It's the comparison function that must fulfill the axioms of a total ordering (C11 Standard, §7.22.5). QVVERTYVS (hm?) 13:25, 22 April 2014 (UTC)
I'm looking at a slightly later draft but I assume this part hasn't changed. I don't think it is intended to mean what a mathematical reader will understand from the words there. In 7.22.5.2 it says "If two elements compare as equal, their order in the resulting sorted array is unspecified.", but in a total ordered set elements are only equal to themselves. Here the intention is to allow two non-identical elements to compare equal (for example the comparison function can compare a key field in each object and ignore the rest of the objects). An order which is like a total order except extra equalities are allowed is a "strict weak ordering", but I'm not suggesting we use that term that since nobody will understand it. McKay (talk) 06:33, 23 April 2014 (UTC)