Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Tim Rentsch
Newsgroups: comp.lang.c
Subject: Re: Baby X is bor nagain
Date: Mon, 24 Jun 2024 07:40:46 -0700
Organization: A noiseless patient Spider
Lines: 38
Message-ID: <861q4mflox.fsf@linuxsc.com>
References: <20240618115650.00006e3f@yahoo.com> <20240618184026.000046e1@yahoo.com> <877celzx14.fsf@nosuchdomain.example.com> <87iky3svqh.fsf@bsb.me.uk> <874j9nxsdy.fsf@nosuchdomain.example.com> <874j9ns382.fsf@bsb.me.uk> <86h6dlhb34.fsf@linuxsc.com> <8734p3rjno.fsf@bsb.me.uk> <86zfrbfsd6.fsf@linuxsc.com> <87msnbtes9.fsf@nosuchdomain.example.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Date: Mon, 24 Jun 2024 16:40:48 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="b3b1304951eae8dc1e53ef86c96f1e35";
logging-data="1040447"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/5w8l4eIxHSYNPhVs4YLeLcL2pJHc+qGc="
User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux)
Cancel-Lock: sha1:3jOjLcTLl4t2KO82qsGj1GtWb2E=
sha1:9qCwtQgCLzD1tLQHrU12bAHPwgg=
Bytes: 3210
Keith Thompson writes:
> Tim Rentsch writes:
>
>> James Kuyper 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.