Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c > #143374 > unrolled thread
| Started by | rick.c.hodgin@gmail.com |
|---|---|
| First post | 2019-04-24 09:08 -0700 |
| Last post | 2019-05-04 05:53 -0700 |
| Articles | 20 on this page of 103 — 26 participants |
Back to article view | Back to comp.lang.c
qsort() standard functions rick.c.hodgin@gmail.com - 2019-04-24 09:08 -0700
Re: qsort() standard functions gazelle@shell.xmission.com (Kenny McCormack) - 2019-04-24 16:12 +0000
Re: qsort() standard functions rick.c.hodgin@gmail.com - 2019-04-24 09:18 -0700
Re: qsort() standard functions Chad <cdalten@gmail.com> - 2019-05-02 12:02 -0700
Re: qsort() standard functions Real Troll <real.troll@trolls.com> - 2019-04-24 22:30 -0400
Re: qsort() standard functions "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2019-04-24 19:32 -0700
Re: qsort() standard functions Jorgen Grahn <grahn+nntp@snipabacken.se> - 2019-04-25 10:19 +0000
Re: qsort() standard functions rick.c.hodgin@gmail.com - 2019-04-25 04:09 -0700
Re: qsort() standard functions Richard Damon <Richard@Damon-Family.org> - 2019-04-25 08:13 -0400
Re: qsort() standard functions fir <profesor.fir@gmail.com> - 2019-04-25 06:39 -0700
Re: qsort() standard functions already5chosen@yahoo.com - 2019-04-25 07:23 -0700
Re: qsort() standard functions fir <profesor.fir@gmail.com> - 2019-04-25 00:39 -0700
Re: qsort() standard functions Real Troll <Real.Troll@Trolls.com> - 2019-04-25 23:27 +0100
Re: qsort() standard functions John Bode <jfbode1029@gmail.com> - 2019-04-24 09:34 -0700
Re: qsort() standard functions "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2019-04-24 09:47 -0700
Re: qsort() standard functions John Bode <jfbode1029@gmail.com> - 2019-04-24 09:47 -0700
Re: qsort() standard functions "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2019-04-24 12:54 -0400
Re: qsort() standard functions John Bode <jfbode1029@gmail.com> - 2019-04-24 11:33 -0700
Re: qsort() standard functions "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2019-04-24 14:41 -0400
Re: qsort() standard functions John Bode <jfbode1029@gmail.com> - 2019-04-24 11:52 -0700
Re: qsort() standard functions gazelle@shell.xmission.com (Kenny McCormack) - 2019-04-24 19:12 +0000
Re: qsort() standard functions "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2019-04-24 16:05 -0400
Re: qsort() standard functions queequeg@trust.no1 (Queequeg) - 2019-04-24 20:39 +0000
Re: qsort() standard functions James Kuyper <jameskuyper@alumni.caltech.edu> - 2019-04-24 16:33 -0700
Re: qsort() standard functions gazelle@shell.xmission.com (Kenny McCormack) - 2019-04-24 19:18 +0000
Re: qsort() standard functions Bart <bc@freeuk.com> - 2019-04-24 20:28 +0100
Re: qsort() standard functions gazelle@shell.xmission.com (Kenny McCormack) - 2019-04-24 21:27 +0000
Re: qsort() standard functions fir <profesor.fir@gmail.com> - 2019-04-24 12:31 -0700
Re: qsort() standard functions John Bode <jfbode1029@gmail.com> - 2019-04-24 13:02 -0700
Re: qsort() standard functions fir <profesor.fir@gmail.com> - 2019-04-24 13:41 -0700
Re: qsort() standard functions fir <profesor.fir@gmail.com> - 2019-04-24 14:00 -0700
Re: qsort() standard functions Anton Shepelev <anton.txt@gmail.com> - 2019-04-25 00:22 +0300
Re: qsort() standard functions fir <profesor.fir@gmail.com> - 2019-04-24 15:04 -0700
Re: qsort() standard functions fir <profesor.fir@gmail.com> - 2019-04-24 15:20 -0700
Re: qsort() standard functions fir <profesor.fir@gmail.com> - 2019-04-24 15:40 -0700
Re: qsort() standard functions fir <profesor.fir@gmail.com> - 2019-04-24 15:57 -0700
Re: qsort() standard functions fir <profesor.fir@gmail.com> - 2019-04-24 16:06 -0700
Re: qsort() standard functions Anton Shepelev <anton.txt@gmail.com> - 2019-04-25 23:49 +0300
Re: qsort() standard functions Ben Bacarisse <ben.usenet@bsb.me.uk> - 2019-04-25 22:45 +0100
Re: qsort() standard functions Bart <bc@freeuk.com> - 2019-04-25 23:00 +0100
Re: qsort() standard functions Ben Bacarisse <ben.usenet@bsb.me.uk> - 2019-04-25 23:24 +0100
Re: qsort() standard functions Real Troll <Real.Troll@Trolls.com> - 2019-04-25 23:20 +0100
Re: qsort() standard functions Anton Shepelev <anton.txt@g{oogle}mail.com> - 2019-04-26 13:06 +0300
Re: qsort() standard functions Ben Bacarisse <ben.usenet@bsb.me.uk> - 2019-04-26 13:38 +0100
Re: qsort() standard functions Anton Shepelev <anton.txt@g{oogle}mail.com> - 2019-04-26 16:43 +0300
Re: qsort() standard functions Ben Bacarisse <ben.usenet@bsb.me.uk> - 2019-04-26 17:46 +0100
Re: qsort() standard functions Anton Shepelev <anton.txt@gmail.com> - 2019-04-27 14:55 +0300
Re: qsort() standard functions Ben Bacarisse <ben.usenet@bsb.me.uk> - 2019-04-27 14:59 +0100
Re: qsort() standard functions Robert Wessel <robertwessel2@yahoo.com> - 2019-04-27 11:41 -0500
Re: qsort() standard functions Tim Rentsch <tr.17687@z991.linuxsc.com> - 2019-05-02 09:46 -0700
Re: qsort() standard functions Anton Shepelev <anton.txt@gmail.com> - 2019-05-02 20:35 +0300
Re: qsort() standard functions fir <profesor.fir@gmail.com> - 2019-05-02 15:35 -0700
Re: qsort() standard functions fir <profesor.fir@gmail.com> - 2019-05-05 04:39 -0700
Re: qsort() standard functions Tim Rentsch <tr.17687@z991.linuxsc.com> - 2019-05-04 07:35 -0700
Re: qsort() standard functions Anton Shepelev <anton.txt@gmail.com> - 2019-05-05 00:01 +0300
Re: qsort() standard functions Anton Shepelev <anton.txt@gmail.com> - 2019-05-02 15:11 +0300
Re: qsort() standard functions Ben Bacarisse <ben.usenet@bsb.me.uk> - 2019-05-02 16:36 +0100
Re: qsort() standard functions Anton Shepelev <anton.txt@gmail.com> - 2019-04-27 14:47 +0300
Re: qsort() standard functions Robert Wessel <robertwessel2@yahoo.com> - 2019-04-27 08:30 -0500
Re: qsort() standard functions Anton Shepelev <anton.txt@gmail.com> - 2019-05-02 14:52 +0300
Re: qsort() standard functions Tim Rentsch <tr.17687@z991.linuxsc.com> - 2019-05-04 07:13 -0700
Re: qsort() standard functions Anton Shepelev <anton.txt@gmail.com> - 2019-05-05 22:57 +0300
Re: qsort() standard functions David Brown <david.brown@hesbynett.no> - 2019-05-06 10:09 +0200
Re: qsort() standard functions Tim Rentsch <tr.17687@z991.linuxsc.com> - 2019-06-01 05:22 -0700
Re: qsort() standard functions fir <profesor.fir@gmail.com> - 2019-04-25 17:09 -0700
Re: qsort() standard functions Bart <bc@freeuk.com> - 2019-04-26 10:58 +0100
Re: qsort() standard functions mark.bluemel@gmail.com - 2019-04-26 03:59 -0700
Re: qsort() standard functions fir <profesor.fir@gmail.com> - 2019-04-26 06:34 -0700
Re: qsort() standard functions fir <profesor.fir@gmail.com> - 2019-04-26 07:16 -0700
Re: qsort() standard functions fir <profesor.fir@gmail.com> - 2019-04-26 07:45 -0700
Re: qsort() standard functions fir <profesor.fir@gmail.com> - 2019-04-26 08:29 -0700
Re: qsort() standard functions fir <profesor.fir@gmail.com> - 2019-04-26 12:06 -0700
Re: qsort() standard functions fir <profesor.fir@gmail.com> - 2019-04-26 13:09 -0700
Re: qsort() standard functions fir <profesor.fir@gmail.com> - 2019-04-26 13:37 -0700
Re: qsort() standard functions fir <profesor.fir@gmail.com> - 2019-04-26 14:05 -0700
Re: qsort() standard functions Anton Shepelev <anton.txt@gmail.com> - 2019-04-27 14:59 +0300
Re: qsort() standard functions fir <profesor.fir@gmail.com> - 2019-04-27 06:19 -0700
Re: qsort() standard functions fir <profesor.fir@gmail.com> - 2019-04-27 06:32 -0700
Re: qsort() standard functions Joe Pfeiffer <pfeiffer@cs.nmsu.edu> - 2019-04-24 10:54 -0600
Re: qsort() standard functions "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2019-04-24 10:10 -0700
Re: qsort() standard functions Anton Shepelev <anton.txt@gmail.com> - 2019-04-25 00:06 +0300
Re: qsort() standard functions scott@slp53.sl.home (Scott Lurndal) - 2019-04-24 17:37 +0000
Re: qsort() standard functions "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2019-04-24 10:56 -0700
Re: qsort() standard functions Joe Pfeiffer <pfeiffer@cs.nmsu.edu> - 2019-04-24 12:12 -0600
Re: qsort() standard functions "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2019-04-24 14:27 -0400
Re: qsort() standard functions John Bode <jfbode1029@gmail.com> - 2019-04-24 11:44 -0700
Re: qsort() standard functions fir <profesor.fir@gmail.com> - 2019-04-24 11:57 -0700
Re: qsort() standard functions fir <profesor.fir@gmail.com> - 2019-04-24 12:04 -0700
Re: qsort() standard functions nobody@example.org (Scott) - 2019-04-25 01:16 +0000
Re: qsort() standard functions James Kuyper <jameskuyper@alumni.caltech.edu> - 2019-04-24 21:38 -0400
Re: qsort() standard functions "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2019-04-24 14:42 -0400
Re: qsort() standard functions David Brown <david.brown@hesbynett.no> - 2019-04-24 22:13 +0200
Re: qsort() standard functions queequeg@trust.no1 (Queequeg) - 2019-04-24 20:46 +0000
Re: qsort() standard functions jadill33@gmail.com - 2019-04-24 14:01 -0700
Re: qsort() standard functions "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2019-04-24 15:41 -0700
Re: qsort() standard functions "Mr. Man-wai Chang" <toylet.toylet@gmail.com> - 2019-04-26 22:24 +0800
Re: qsort() standard functions Anton Shepelev <anton.txt@gmail.com> - 2019-05-02 15:05 +0300
Re: qsort() standard functions "Mr. Man-wai Chang" <toylet.toylet@gmail.com> - 2019-05-03 17:02 +0800
Re: qsort() standard functions Chad <cdalten@gmail.com> - 2019-05-03 10:10 -0700
Re: qsort() standard functions "Mr. Man-wai Chang" <toylet.toylet@gmail.com> - 2019-05-04 01:22 +0800
Re: qsort() standard functions Chad <cdalten@gmail.com> - 2019-05-03 15:14 -0700
[OT]Eternal.... programmer? "Mr. Man-wai Chang" <toylet.toylet@gmail.com> - 2019-05-04 06:20 +0800
Re: [OT]Eternal.... programmer? Chad <cdalten@gmail.com> - 2019-05-04 05:53 -0700
Page 1 of 6 [1] 2 3 4 5 6 Next page →
| From | rick.c.hodgin@gmail.com |
|---|---|
| Date | 2019-04-24 09:08 -0700 |
| Subject | qsort() standard functions |
| Message-ID | <eb0fe034-9828-4098-a80b-641ee539251e@googlegroups.com> |
Does qsort() provide any standard function support? Like if I'm sorting a list of integers, is there a qsort_int() func I can use without creating my own? And what about strings? Or other things which are standard forms to C? -- Rick C. Hodgin
[toc] | [next] | [standalone]
| From | gazelle@shell.xmission.com (Kenny McCormack) |
|---|---|
| Date | 2019-04-24 16:12 +0000 |
| Message-ID | <q9q1tf$cd3$1@news.xmission.com> |
| In reply to | #143374 |
In article <eb0fe034-9828-4098-a80b-641ee539251e@googlegroups.com>, <rick.c.hodgin@gmail.com> wrote: >Does qsort() provide any standard function support? Like if >I'm sorting a list of integers, is there a qsort_int() func >I can use without creating my own? And what about strings? >Or other things which are standard forms to C? You get the same answer as you get to all your dorky posts. No. -- http://www.rollingstone.com/politics/news/the-10-dumbest-things-ever-said-about-global-warming-20130619
[toc] | [prev] | [next] | [standalone]
| From | rick.c.hodgin@gmail.com |
|---|---|
| Date | 2019-04-24 09:18 -0700 |
| Message-ID | <ec097648-4935-4693-aed4-ec2b74626ab9@googlegroups.com> |
| In reply to | #143375 |
On Wednesday, April 24, 2019 at 12:12:41 PM UTC-4, Kenny McCormack wrote: > In article <eb0fe034-9828-4098-a80b-641ee539251e@googlegroups.com>, > <rick.c.hodgin@gmail.com> wrote: > >Does qsort() provide any standard function support? Like if > >I'm sorting a list of integers, is there a qsort_int() func > >I can use without creating my own? And what about strings? > >Or other things which are standard forms to C? > > You get the same answer as you get to all your dorky posts. I am unaware of any dorky posts. Must be personal opinion being applied and not anything objective or factual. > No. I cannot trust the things you say, Kenny. You are wishy washy and come across one way a particular day, another way another day. It creates confusion and is undesirable. Would you like to quote me out of context again in your next reply so as to misrepresent me purposefully to cause me harm? And you say I have dorky posts? You will soon see, sir, the extent to which not only are your posts contrary to things desirable, but go many steps further well beyond that point. -- Rick C. Hodgin
[toc] | [prev] | [next] | [standalone]
| From | Chad <cdalten@gmail.com> |
|---|---|
| Date | 2019-05-02 12:02 -0700 |
| Message-ID | <6431ff6a-abab-423d-8d72-8b8af0a7414a@googlegroups.com> |
| In reply to | #143376 |
On Wednesday, April 24, 2019 at 9:18:58 AM UTC-7, Rick C. Hodgin wrote: > On Wednesday, April 24, 2019 at 12:12:41 PM UTC-4, Kenny McCormack wrote: > > In article <eb0fe034-9828-4098-a80b-641ee539251e@googlegroups.com>, > > <rick.c.hodgin@gmail.com> wrote: > > >Does qsort() provide any standard function support? Like if > > >I'm sorting a list of integers, is there a qsort_int() func > > >I can use without creating my own? And what about strings? > > >Or other things which are standard forms to C? > > > > You get the same answer as you get to all your dorky posts. > > I am unaware of any dorky posts. Must be personal opinion being > applied and not anything objective or factual. > > > No. > > I cannot trust the things you say, Kenny. You are wishy washy > and come across one way a particular day, another way another day. > It creates confusion and is undesirable. > > Would you like to quote me out of context again in your next reply > so as to misrepresent me purposefully to cause me harm? And you > say I have dorky posts? You will soon see, sir, the extent to > which not only are your posts contrary to things desirable, but go > many steps further well beyond that point. > FIGHT FIGHT.
[toc] | [prev] | [next] | [standalone]
| From | Real Troll <real.troll@trolls.com> |
|---|---|
| Date | 2019-04-24 22:30 -0400 |
| Message-ID | <q9r60g$9hf$1@gioia.aioe.org> |
| In reply to | #143375 |
On 24/04/2019 17:12, Kenny McCormack wrote: > In article <eb0fe034-9828-4098-a80b-641ee539251e@googlegroups.com>, > <rick.c.hodgin@gmail.com> wrote: >> Does qsort() provide any standard function support? Like if >> I'm sorting a list of integers, is there a qsort_int() func >> I can use without creating my own? And what about strings? >> Or other things which are standard forms to C? > You get the same answer as you get to all your dorky posts. > > No. > I don't see the original post so I am posting here. Stanford Uni has got an example at this link: <http://theory.stanford.edu/~amitp/rants/c++-vs-c/test2.cc> <http://theory.stanford.edu/~amitp/rants/c++-vs-c/test3.cc> The main document is here: <http://theory.stanford.edu/~amitp/rants/c++-vs-c/>
[toc] | [prev] | [next] | [standalone]
| From | "Rick C. Hodgin" <rick.c.hodgin@gmail.com> |
|---|---|
| Date | 2019-04-24 19:32 -0700 |
| Message-ID | <dc5a0074-ce2f-4ac6-bb5d-96b6a0904f4d@googlegroups.com> |
| In reply to | #143419 |
On Wednesday, April 24, 2019 at 10:28:43 PM UTC-4, Real Troll wrote: > The main document is here: > <http://theory.stanford.edu/~amitp/rants/c++-vs-c/> Written in 2000. Thank you for posting. I'm not the only one who thinks it's missing from where it should be. -- Rick C. Hodgim
[toc] | [prev] | [next] | [standalone]
| From | Jorgen Grahn <grahn+nntp@snipabacken.se> |
|---|---|
| Date | 2019-04-25 10:19 +0000 |
| Message-ID | <slrnqc32e5.1skk.grahn+nntp@frailea.sa.invalid> |
| In reply to | #143420 |
On Thu, 2019-04-25, Rick C. Hodgin wrote: > On Wednesday, April 24, 2019 at 10:28:43 PM UTC-4, Real Troll wrote: >> The main document is here: >> <http://theory.stanford.edu/~amitp/rants/c++-vs-c/> > > Written in 2000. Thank you for posting. > > I'm not the only one who thinks it's missing from where it should be. As far as I can tell he didn't want C to get an standard function for sorting ints; he wants to avoid the problem by using C++. /Jorgen -- // Jorgen Grahn <grahn@ Oo o. . . \X/ snipabacken.se> O o .
[toc] | [prev] | [next] | [standalone]
| From | rick.c.hodgin@gmail.com |
|---|---|
| Date | 2019-04-25 04:09 -0700 |
| Message-ID | <2763dd26-30ab-4c6a-8195-7926dd9d8609@googlegroups.com> |
| In reply to | #143422 |
On Thursday, April 25, 2019 at 6:20:00 AM UTC-4, Jorgen Grahn wrote:
> On Thu, 2019-04-25, Rick C. Hodgin wrote:
> > On Wednesday, April 24, 2019 at 10:28:43 PM UTC-4, Real Troll wrote:
> >> The main document is here:
> >> <http://theory.stanford.edu/~amitp/rants/c++-vs-c/>
> >
> > Written in 2000. Thank you for posting.
> >
> > I'm not the only one who thinks it's missing from where it should be.
>
> As far as I can tell he didn't want C to get an standard function for
> sorting ints; he wants to avoid the problem by using C++.
Wouldn't have been an issue if C provided support for its fundamental
types.
I made the same argument around 2010 for the authors of MPFR for GNU
creating this amazing arbitrary precision floating point algorithm,
but not adding any native support to GDB to display their new big
floating point values in the debugger. Was only half a solution,
because it may have worked, but every developer would be required
to write their own display-in-the-debugger algorithms. Clunky.
Same here for qsort() not have standard sort functions for integrated
types:
qsort_char_up() // Ascending order
qsort_char_down() // Descending order
Same for at least short, int, long, float, double. And also their
unsigned counterparts:
qsort_uchar_up()
qsort_uchar_down()
Maybe also support for strings:
qsort_str_up()
qsort_str_down()
14 functions or so to fill C's needs for basic sorting, and remove
the burden of having every developer write their own.
Seems to be a natural extension (at least to me).
--
Rick C. Hodgin
[toc] | [prev] | [next] | [standalone]
| From | Richard Damon <Richard@Damon-Family.org> |
|---|---|
| Date | 2019-04-25 08:13 -0400 |
| Message-ID | <DvhwE.103007$7y4.96569@fx25.iad> |
| In reply to | #143423 |
On 4/25/19 7:09 AM, rick.c.hodgin@gmail.com wrote: > On Thursday, April 25, 2019 at 6:20:00 AM UTC-4, Jorgen Grahn wrote: >> On Thu, 2019-04-25, Rick C. Hodgin wrote: >>> On Wednesday, April 24, 2019 at 10:28:43 PM UTC-4, Real Troll wrote: >>>> The main document is here: >>>> <http://theory.stanford.edu/~amitp/rants/c++-vs-c/> >>> >>> Written in 2000. Thank you for posting. >>> >>> I'm not the only one who thinks it's missing from where it should be. >> >> As far as I can tell he didn't want C to get an standard function for >> sorting ints; he wants to avoid the problem by using C++. > > Wouldn't have been an issue if C provided support for its fundamental > types. > > I made the same argument around 2010 for the authors of MPFR for GNU > creating this amazing arbitrary precision floating point algorithm, > but not adding any native support to GDB to display their new big > floating point values in the debugger. Was only half a solution, > because it may have worked, but every developer would be required > to write their own display-in-the-debugger algorithms. Clunky. > > Same here for qsort() not have standard sort functions for integrated > types: > > qsort_char_up() // Ascending order > qsort_char_down() // Descending order > > Same for at least short, int, long, float, double. And also their > unsigned counterparts: > > qsort_uchar_up() > qsort_uchar_down() > > Maybe also support for strings: > > qsort_str_up() > qsort_str_down() > > 14 functions or so to fill C's needs for basic sorting, and remove > the burden of having every developer write their own. > > Seems to be a natural extension (at least to me). > But if you look at where you could actually use the functions, it seems just about nowhere. How often do you have an array of char (and just an array of char) and you want it sorted, or an array of numbers. It is very rare. Most often, you have an array of structures (or pointer to structures) which you want sorted by some field in that structure. Unless you add something with the power of the C++ template, you can't reasonably make such a standard function. Yes, you could define a set of generator macros that could be used for this, but the C Standard has avoided defining this sort of thing.
[toc] | [prev] | [next] | [standalone]
| From | fir <profesor.fir@gmail.com> |
|---|---|
| Date | 2019-04-25 06:39 -0700 |
| Message-ID | <f6ed63bd-94ca-4ce2-82ae-13a6abf99744@googlegroups.com> |
| In reply to | #143424 |
W dniu czwartek, 25 kwietnia 2019 14:13:35 UTC+2 użytkownik Richard Damon napisał:
> On 4/25/19 7:09 AM, rick.c.hodgin@gmail.com wrote:
> > On Thursday, April 25, 2019 at 6:20:00 AM UTC-4, Jorgen Grahn wrote:
> >> On Thu, 2019-04-25, Rick C. Hodgin wrote:
> >>> On Wednesday, April 24, 2019 at 10:28:43 PM UTC-4, Real Troll wrote:
> >>>> The main document is here:
> >>>> <http://theory.stanford.edu/~amitp/rants/c++-vs-c/>
> >>>
> >>> Written in 2000. Thank you for posting.
> >>>
> >>> I'm not the only one who thinks it's missing from where it should be.
> >>
> >> As far as I can tell he didn't want C to get an standard function for
> >> sorting ints; he wants to avoid the problem by using C++.
> >
> > Wouldn't have been an issue if C provided support for its fundamental
> > types.
> >
> > I made the same argument around 2010 for the authors of MPFR for GNU
> > creating this amazing arbitrary precision floating point algorithm,
> > but not adding any native support to GDB to display their new big
> > floating point values in the debugger. Was only half a solution,
> > because it may have worked, but every developer would be required
> > to write their own display-in-the-debugger algorithms. Clunky.
> >
> > Same here for qsort() not have standard sort functions for integrated
> > types:
> >
> > qsort_char_up() // Ascending order
> > qsort_char_down() // Descending order
> >
> > Same for at least short, int, long, float, double. And also their
> > unsigned counterparts:
> >
> > qsort_uchar_up()
> > qsort_uchar_down()
> >
> > Maybe also support for strings:
> >
> > qsort_str_up()
> > qsort_str_down()
> >
> > 14 functions or so to fill C's needs for basic sorting, and remove
> > the burden of having every developer write their own.
> >
> > Seems to be a natural extension (at least to me).
> >
>
> But if you look at where you could actually use the functions, it seems
> just about nowhere. How often do you have an array of char (and just an
> array of char) and you want it sorted, or an array of numbers. It is
> very rare. Most often, you have an array of structures (or pointer to
> structures) which you want sorted by some field in that structure.
> Unless you add something with the power of the C++ template, you can't
> reasonably make such a standard function.
>
> Yes, you could define a set of generator macros that could be used for
> this, but the C Standard has avoided defining this sort of thing.
quicksort from c lib is rather for lamers, so maybe let crap-programmer spamer and active stupidizer dik alone with his problems?
normal user would use rather something like this code from this link posted (or write it himself, i mean not recurential form of qsort)
/* C, code from Numerical Recipes */
#include <time.h>
#include <stdlib.h>
#include <iostream.h>
#include <algo.h>
// 7 is the threshold defined in the book, so that's what I used
#define M 7
// 50 is the limit defined in the book, so that's what I used
#define NSTACK 50
void num_rec_sort(int n, TYPE arr[])
{
// This code is from Numerical Recipes, with minor changes
int i, ir=n, j, k, l=0, *istack;
int jstack = 0;
TYPE a;
istack = new int[NSTACK]; // manage our own stack
for(;;) {
if(ir-l < M) { // Insertion sort when subarray small enough
for(j=l+1; j<ir; j++) {
a=arr[j];
for(i=j-1; i>=1; i--) {
if(arr[i] <= a) break;
arr[i+1]=arr[i];
}
arr[i+1]=a;
}
if(jstack == 0) break;
ir=istack[jstack--];
l=istack[jstack--];
} else { // quicksort when the subarray is large
k=(l+ir)>>1;
swap(arr[k], arr[l+1]);
if(arr[l] > arr[ir]) {
swap(arr[l], arr[ir]);
}
if(arr[l+1] > arr[ir]) {
swap(arr[l+1], arr[ir]);
}
if(arr[l] > arr[l+1]) {
swap(arr[l], arr[l+1]);
}
i=l+1;
j=ir;
a=arr[l+1];
for(;;) {
do i++; while(arr[i] < a);
do j--; while(arr[j] > a);
if(j<i) break;
swap(arr[i], arr[j]);
}
arr[l+1]=arr[j];
arr[j]=a;
jstack += 2;
if(jstack > NSTACK) abort();
if(ir-i+1 >= j-1) {
istack[jstack]=ir;
istack[jstack-1]=i;
ir=j-1;
} else {
istack[jstack]=j-1;
istack[jstack-1]=l;
l=i;
}
}
}
delete[] istack;
}
only he would improve it by removing this test on overflow and eventuallt turned new to realoock
and in case of sppec would compiled separate versions for real use cases if needed
(most probably you will sort an array opf records, and in that case most probable is probably to create and store an additional array with 'sorted' indexes
to untouched array) (probably)
im not sure if i should do the tests, i feel lazy
[toc] | [prev] | [next] | [standalone]
| From | already5chosen@yahoo.com |
|---|---|
| Date | 2019-04-25 07:23 -0700 |
| Message-ID | <46c15367-34f1-4a33-8b01-e9a44e4ae11e@googlegroups.com> |
| In reply to | #143424 |
On Thursday, April 25, 2019 at 3:13:35 PM UTC+3, Richard Damon wrote: > On 4/25/19 7:09 AM, rick.c.hodgin@gmail.com wrote: > > On Thursday, April 25, 2019 at 6:20:00 AM UTC-4, Jorgen Grahn wrote: > >> On Thu, 2019-04-25, Rick C. Hodgin wrote: > >>> On Wednesday, April 24, 2019 at 10:28:43 PM UTC-4, Real Troll wrote: > >>>> The main document is here: > >>>> <http://theory.stanford.edu/~amitp/rants/c++-vs-c/> > >>> > >>> Written in 2000. Thank you for posting. > >>> > >>> I'm not the only one who thinks it's missing from where it should be. > >> > >> As far as I can tell he didn't want C to get an standard function for > >> sorting ints; he wants to avoid the problem by using C++. > > > > Wouldn't have been an issue if C provided support for its fundamental > > types. > > > > I made the same argument around 2010 for the authors of MPFR for GNU > > creating this amazing arbitrary precision floating point algorithm, > > but not adding any native support to GDB to display their new big > > floating point values in the debugger. Was only half a solution, > > because it may have worked, but every developer would be required > > to write their own display-in-the-debugger algorithms. Clunky. > > > > Same here for qsort() not have standard sort functions for integrated > > types: > > > > qsort_char_up() // Ascending order > > qsort_char_down() // Descending order > > > > Same for at least short, int, long, float, double. And also their > > unsigned counterparts: > > > > qsort_uchar_up() > > qsort_uchar_down() > > > > Maybe also support for strings: > > > > qsort_str_up() > > qsort_str_down() > > > > 14 functions or so to fill C's needs for basic sorting, and remove > > the burden of having every developer write their own. > > > > Seems to be a natural extension (at least to me). > > > > But if you look at where you could actually use the functions, it seems > just about nowhere. How often do you have an array of char (and just an > array of char) and you want it sorted, or an array of numbers. It is > very rare. Most often, you have an array of structures (or pointer to > structures) which you want sorted by some field in that structure. > Unless you add something with the power of the C++ template, you can't > reasonably make such a standard function. > > Yes, you could define a set of generator macros that could be used for > this, but the C Standard has avoided defining this sort of thing. If I am not mistaken, the standard does not provide an equivalent of Windows kernel's CONTAINING_RECORD or Linux kernel's container_of macro, but nearly all implementations have them. It means, that sorting pointers to records could be [non-portably but usefully] replaced by sorting pointers to keys, contained in the records. So, at least three specialized variants of "sort pointer to key" routine, for signed int, unsigned int and ASCIIZ key, look to me like sufficiently useful candidates for standard library.
[toc] | [prev] | [next] | [standalone]
| From | fir <profesor.fir@gmail.com> |
|---|---|
| Date | 2019-04-25 00:39 -0700 |
| Message-ID | <e5de6482-c5fb-4494-88cf-30051e21ff72@googlegroups.com> |
| In reply to | #143419 |
W dniu czwartek, 25 kwietnia 2019 04:28:43 UTC+2 użytkownik Real Troll napisał: > On 24/04/2019 17:12, Kenny McCormack wrote: > > In article <eb0fe034-9828-4098-a80b-641ee539251e@googlegroups.com>, > > <rick.c.hodgin@gmail.com> wrote: > >> Does qsort() provide any standard function support? Like if > >> I'm sorting a list of integers, is there a qsort_int() func > >> I can use without creating my own? And what about strings? > >> Or other things which are standard forms to C? > > You get the same answer as you get to all your dorky posts. > > > > No. > > > I don't see the original post so I am posting here. > > Stanford Uni has got an example at this link: > > <http://theory.stanford.edu/~amitp/rants/c++-vs-c/test2.cc> > > <http://theory.stanford.edu/~amitp/rants/c++-vs-c/test3.cc> > > The main document is here: > > <http://theory.stanford.edu/~amitp/rants/c++-vs-c/> lol bow-bow-bow-bow-bow-bow-bow-wow that 'numarical recipes' c verion compared is badly written becouse it has test on array overflow which is not needed and may be costly if someone uses that code and uses it to say that c is sometimes slower than c++ its mightly stupid like overally taking one code in c compared to another code in c++ and saying that c++ is faster (besides as it uses new its not fully c) this article is somewhat ok (esp it has non stack qsort what was recently talked about) but makes rather bulshit conclusions
[toc] | [prev] | [next] | [standalone]
| From | Real Troll <Real.Troll@Trolls.com> |
|---|---|
| Date | 2019-04-25 23:27 +0100 |
| Message-ID | <q9tc7m$1ktd$1@gioia.aioe.org> |
| In reply to | #143421 |
On 25/04/2019 08:39, fir wrote: > lol bow-bow-bow-bow-bow-bow-bow-wow > > that 'numarical recipes' c verion compared is badly written becouse it has test on array overflow which is not needed and may be costly > > if someone uses that code and uses it to say that c is sometimes slower than c++ > its mightly stupid > > like overally taking one code in c compared to another code in c++ and saying that c++ is faster (besides as it uses new its not fully c) > > this article is somewhat ok (esp it has non stack qsort what was recently talked about) but makes rather bulshit conclusions > You missed the point of those examples and the article. The guy wrote that piece in 2000 when he didn't have sophisticated compilers and algorithms but he just wanted people to stop criticising standard libraries in the compilers available at the time. Knuth was the god in those days also of Stanford. <https://www-cs-faculty.stanford.edu/~knuth/>
[toc] | [prev] | [next] | [standalone]
| From | John Bode <jfbode1029@gmail.com> |
|---|---|
| Date | 2019-04-24 09:34 -0700 |
| Message-ID | <e95d755c-02ef-44e4-a284-a050154b3b49@googlegroups.com> |
| In reply to | #143374 |
On Wednesday, April 24, 2019 at 11:08:57 AM UTC-5, rick....@gmail.com wrote: > Does qsort() provide any standard function support? Like if > I'm sorting a list of integers, is there a qsort_int() func > I can use without creating my own? And what about strings? > Or other things which are standard forms to C? > > -- > Rick C. Hodgin Nope. Gotta roll your own, even for primitive types.
[toc] | [prev] | [next] | [standalone]
| From | "Rick C. Hodgin" <rick.c.hodgin@gmail.com> |
|---|---|
| Date | 2019-04-24 09:47 -0700 |
| Message-ID | <deb3b9f5-f585-4e01-bb2e-25d32cfa6744@googlegroups.com> |
| In reply to | #143377 |
On Wednesday, April 24, 2019 at 12:35:26 PM UTC-4, John Bode wrote: > On Wednesday, April 24, 2019 at 11:08:57 AM UTC-5, rick....@gmail.com wrote: > > Does qsort() provide any standard function support? Like if > > I'm sorting a list of integers, is there a qsort_int() func > > I can use without creating my own? And what about strings? > > Or other things which are standard forms to C? > > Nope. Gotta roll your own, even for primitive types. Thank you, Mr. Bode. -- Rick C. Hodgin
[toc] | [prev] | [next] | [standalone]
| From | John Bode <jfbode1029@gmail.com> |
|---|---|
| Date | 2019-04-24 09:47 -0700 |
| Message-ID | <fda6fac4-7cdb-4c35-9383-9c65a154a70f@googlegroups.com> |
| In reply to | #143377 |
On Wednesday, April 24, 2019 at 11:35:26 AM UTC-5, John Bode wrote: > On Wednesday, April 24, 2019 at 11:08:57 AM UTC-5, rick....@gmail.com wrote: > > Does qsort() provide any standard function support? Like if > > I'm sorting a list of integers, is there a qsort_int() func > > I can use without creating my own? And what about strings? > > Or other things which are standard forms to C? > > > > -- > > Rick C. Hodgin > > Nope. Gotta roll your own, even for primitive types. For future reference, an online draft of the 2011 standard is here: http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1570.pdf It will tell you what is in the standard library.
[toc] | [prev] | [next] | [standalone]
| From | "Rick C. Hodgin" <rick.c.hodgin@gmail.com> |
|---|---|
| Date | 2019-04-24 12:54 -0400 |
| Message-ID | <q9q491$oid$1@dont-email.me> |
| In reply to | #143379 |
On 4/24/2019 12:47 PM, John Bode wrote: > On Wednesday, April 24, 2019 at 11:35:26 AM UTC-5, John Bode wrote: >> On Wednesday, April 24, 2019 at 11:08:57 AM UTC-5, rick....@gmail.com wrote: >>> Does qsort() provide any standard function support? Like if >>> I'm sorting a list of integers, is there a qsort_int() func >>> I can use without creating my own? And what about strings? >>> Or other things which are standard forms to C? >> Nope. Gotta roll your own, even for primitive types. > > For future reference, an online draft of the 2011 standard is here: > > http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1570.pdf > > It will tell you what is in the standard library. Using that reference, how would I find the answer to this question? -- Rick C. Hodgin
[toc] | [prev] | [next] | [standalone]
| From | John Bode <jfbode1029@gmail.com> |
|---|---|
| Date | 2019-04-24 11:33 -0700 |
| Message-ID | <3f29d93d-576f-498d-ac20-51d6256246ce@googlegroups.com> |
| In reply to | #143380 |
On Wednesday, April 24, 2019 at 11:53:00 AM UTC-5, Rick C. Hodgin wrote: > On 4/24/2019 12:47 PM, John Bode wrote: > > On Wednesday, April 24, 2019 at 11:35:26 AM UTC-5, John Bode wrote: > >> On Wednesday, April 24, 2019 at 11:08:57 AM UTC-5, rick....@gmail.com wrote: > >>> Does qsort() provide any standard function support? Like if > >>> I'm sorting a list of integers, is there a qsort_int() func > >>> I can use without creating my own? And what about strings? > >>> Or other things which are standard forms to C? > >> Nope. Gotta roll your own, even for primitive types. > > > > For future reference, an online draft of the 2011 standard is here: > > > > http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1570.pdf > > > > It will tell you what is in the standard library. > > > Using that reference, how would I find the answer to this question? > > -- > Rick C. Hodgin You would check what functions *are* listed in the standard library - if none of them look like the functions you're expecting to see, then that's your answer. Presumably if they existed, they'd be described alongside qsort() and bsearch(). There's nothing stopping individual implementations from providing their own comparison functions (I'm not aware of any that do offhand), but again, that's a matter of checking the documentation.
[toc] | [prev] | [next] | [standalone]
| From | "Rick C. Hodgin" <rick.c.hodgin@gmail.com> |
|---|---|
| Date | 2019-04-24 14:41 -0400 |
| Message-ID | <q9qaie$vko$1@dont-email.me> |
| In reply to | #143387 |
On 4/24/2019 2:33 PM, John Bode wrote: > On Wednesday, April 24, 2019 at 11:53:00 AM UTC-5, Rick C. Hodgin wrote: >> On 4/24/2019 12:47 PM, John Bode wrote: >>> On Wednesday, April 24, 2019 at 11:35:26 AM UTC-5, John Bode wrote: >>>> On Wednesday, April 24, 2019 at 11:08:57 AM UTC-5, rick....@gmail.com wrote: >>>>> Does qsort() provide any standard function support? Like if >>>>> I'm sorting a list of integers, is there a qsort_int() func >>>>> I can use without creating my own? And what about strings? >>>>> Or other things which are standard forms to C? >>>> Nope. Gotta roll your own, even for primitive types. >>> >>> For future reference, an online draft of the 2011 standard is here: >>> >>> http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1570.pdf >>> >>> It will tell you what is in the standard library. >> >> >> Using that reference, how would I find the answer to this question? > > You would check what functions *are* listed in the standard library - if none of them look > like the functions you're expecting to see, then that's your answer. Presumably if they > existed, they'd be described alongside qsort() and bsearch(). > > There's nothing stopping individual implementations from providing their own comparison > functions (I'm not aware of any that do offhand), but again, that's a matter of checking > the documentation. I see the pages 493 to 520 with standard library functions. I did a search for "const void *, const void *" to see how many functions there were with that signature and I found four references (bsearch() and qsort(), twice each). Does that answer my question? Are there not other named functions without that defined prototype which identify their use? I got back to the idea that it seems to require a large investment of time and effort to search, when I could ask a question here on the comp.lang.c group that multiple people likely know the answer to off the top of their head. -- Rick C. Hodgin
[toc] | [prev] | [next] | [standalone]
| From | John Bode <jfbode1029@gmail.com> |
|---|---|
| Date | 2019-04-24 11:52 -0700 |
| Message-ID | <60431626-a673-4a46-afc9-9d180ee434e3@googlegroups.com> |
| In reply to | #143388 |
On Wednesday, April 24, 2019 at 1:40:25 PM UTC-5, Rick C. Hodgin wrote: > On 4/24/2019 2:33 PM, John Bode wrote: > > On Wednesday, April 24, 2019 at 11:53:00 AM UTC-5, Rick C. Hodgin wrote: > >> On 4/24/2019 12:47 PM, John Bode wrote: > >>> On Wednesday, April 24, 2019 at 11:35:26 AM UTC-5, John Bode wrote: > >>>> On Wednesday, April 24, 2019 at 11:08:57 AM UTC-5, rick....@gmail.com wrote: > >>>>> Does qsort() provide any standard function support? Like if > >>>>> I'm sorting a list of integers, is there a qsort_int() func > >>>>> I can use without creating my own? And what about strings? > >>>>> Or other things which are standard forms to C? > >>>> Nope. Gotta roll your own, even for primitive types. > >>> > >>> For future reference, an online draft of the 2011 standard is here: > >>> > >>> http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1570.pdf > >>> > >>> It will tell you what is in the standard library. > >> > >> > >> Using that reference, how would I find the answer to this question? > > > > You would check what functions *are* listed in the standard library - if none of them look > > like the functions you're expecting to see, then that's your answer. Presumably if they > > existed, they'd be described alongside qsort() and bsearch(). > > > > There's nothing stopping individual implementations from providing their own comparison > > functions (I'm not aware of any that do offhand), but again, that's a matter of checking > > the documentation. > > I see the pages 493 to 520 with standard library functions. I did a > search for "const void *, const void *" to see how many functions there > were with that signature and I found four references (bsearch() and > qsort(), twice each). > > Does that answer my question? Are there not other named functions > without that defined prototype which identify their use? > > I got back to the idea that it seems to require a large investment > of time and effort to search, when I could ask a question here on > the comp.lang.c group that multiple people likely know the answer > to off the top of their head. > > -- > Rick C. Hodgin So you rely on *us* to invest all the time and effort you don't want to so we can answer *your* questions. And I thought *I* was lazy. Seriously, why do you think we *can* answer your (ridiculously easy) questions off the top of our heads? How do you think we acquired that knowledge? You think we were born with it? Had it downloaded straight into our heads a la The Matrix? What makes you so goddamned entitled that you believe you shouldn't have to put in *any* effort of your own? Grow the hell up, Rick.
[toc] | [prev] | [next] | [standalone]
Page 1 of 6 [1] 2 3 4 5 6 Next page →
Back to top | Article view | comp.lang.c
csiph-web