🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #5005

Re: Restrictions on qsort compare function?

#5005
From: David Adrien Tanguay
Date: Mon, 08 Apr 1996 23:00
37 lines
2135 bytes
fred@genesis.demon.co.uk writes:
>Such a comparison function is not consistent with sorting.
>It is not the job of the C standard to define basic computer science terms.
>Sorting has a well defined meaning and your comparison function is
>inconsistent with that meaning.

That's just hand-waving. Look at the OOP mess for "basic c.s. terms", or even
the meaning of "function" in the various CS communities. :-)

From ANSI X3/TR-1-82 American National Dictionary for Information Processing
Systems (_xxx_ is italics, defined elsewhere in the dictionary):

sort
(1) The _operation_ of sorting.
(2) (ISO) To segregate _items_ into groups according to a specified criteria.
    Sorting involves _ordering_, but need not involve _sequencing_ for the
    groups may be arranged in an arbitrary order.
(3) To arrange a _set_ of _items_ according to keys which are used as a
    basis for determining the _sequence_ of the items, e.g., to arrange the
    records of a personnel _file_ into alphabetical sequence by using the
    employee names as _sort keys_.
(4) See _balanced merge sort_, _bubble sort_, [etc. etc.]

order
(1) (ISO) A specified arrangement used in ordering. An order need not be
    linear.
(2) (ISO) To place _items_ in an arrangement in accordance with specified
    rules.
(3) (ISO) Deprecated term for _instruction_, _sequence_ (1).


For Peter Curran: What if a particular comparison function causes some qsort
to go into an infinite loop? Is that a non-conforming qsort or a n-c
comparison function?
-- 
David Tanguay       dat@Thinkage.on.ca       http://www.thinkage.on.ca/~dat/
Thinkage, Ltd.           Kitchener, Ontario, Canada          [43.24N 80.29W]
Technical Details
Message-ID: <DpKFxB.BGG@thinkage.on.ca>
Path: arc1-ca.pugleaf.net!thinkage.on.ca!dat
References: <828644274snz@genesis.demon.co.uk> <4k28t4$2g0@sam.inforamp.net> <828726582snz@genesis.demon.co.uk>

Show Full Headers
Complete Article Headers
Newsgroups: comp.std.c
Path: arc1-ca.pugleaf.net!thinkage.on.ca!dat
From: dat@thinkage.on.ca (David Adrien Tanguay)
Subject: Re: Restrictions on qsort compare function?
Message-ID: <DpKFxB.BGG@thinkage.on.ca>
Sender: news@thinkage.on.ca
Organization: Thinkage Ltd., Kitchener, Ontario
References: <828644274snz@genesis.demon.co.uk> <4k28t4$2g0@sam.inforamp.net> <828726582snz@genesis.demon.co.uk>
Date: Mon, 8 Apr 1996 23:00:47 GMT