Liste des Groupes | Revenir à cl c |
Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:Tim Rentsch <tr.17687@z991.linuxsc.com> writes:>James Kuyper <jameskuyper@alumni.caltech.edu> writes:>
[on the requirements for qsort]I certainly would favor improved wording that made this clearer.>
In fact, simply explicitly mandating total ordering rather than
making a vague comment about consistency would probably be the
best approach.
Clearly the C standard intends to impose a weaker requirement
than that the comparison function be a total ordering.
"That is, for qsort they shall define a total ordering on the
array".
>
I presume you didn't intend to contradict that requirement, but
I can't figure out what you meant -- unless, as Ben suggested,
you're distinguishing between a total ordering of all possible
arguments and a total ordering of objects present in the array.
But even then, the standard explicitly imposes a total ordering.
(The requirements for bsearch might be weaker, but we're discussing
qsort.)
>
Can you clarify what you meant?
For starters, saying that the comparison function defines a total
ordering of elements actually present in the array is already a
weaker requirement than saying that the comparison function defines
a total ordering of all values that might legally be present in the
array.
>
Now notice that the C standard isn't referring to the comparison
function in the statement quoted above. The standard does not say
"the comparison function shall define". What it does say is that
"/they/ shall define". Those two aren't the same thing.
Les messages affichés proviennent d'usenet.