Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > qsort man page

Reply
Thread Tools

qsort man page

 
 
Barry Schwarz
Guest
Posts: n/a
 
      07-26-2012
On Wednesday, July 25, 2012 10:51:12 PM UTC-5, Bill Cunningham wrote:

> Scalar or aggregate object? Huh? I'm not touching this one. This post isn't addressed to me anyway it might be best just to abandon this thread.


Thios is a Usenet discussion group. Posts are not addressed to individuals at all.

If you are willing to abandon the thread without ever demonstrating that you have understood the answers to your original question, in fact just the opposite, one has to wonder why you bothered to ask in the first place.
 
Reply With Quote
 
 
 
 
Bill Cunningham
Guest
Posts: n/a
 
      07-27-2012
On Thursday, July 26, 2012 5:27:57 PM UTC-4, Barry Schwarz wrote:

> Thios is a Usenet discussion group. Posts are not addressed to individuals at all.
>
> If you are willing to abandon the thread without ever demonstrating that you have understood the answers to your original question, in fact just the opposite, one has to wonder why you bothered to ask in the first place.


I doubt that I could ever demonstrate to clc that I have the answers to the question even if I did. clc isn't exactly a learning group. Not enough patience. This is getting too technical. Doomed to failure. Thanks anyway.

 
Reply With Quote
 
 
 
 
Barry Schwarz
Guest
Posts: n/a
 
      07-28-2012
On Thursday, July 26, 2012 8:20:07 PM UTC-5, Bill Cunningham wrote:
> On Thursday, July 26, 2012 5:27:57 PM UTC-4, Barry Schwarz wrote:
>
>
>
> > Thios is a Usenet discussion group. Posts are not addressed to individuals at all.

>
> >

>
> > If you are willing to abandon the thread without ever demonstrating that you have understood the answers to your original question, in fact just the opposite, one has to wonder why you bothered to ask in the first place.

>
>
>
> I doubt that I could ever demonstrate to clc that I have the answers to the question even if I did. clc isn't exactly a learning group. Not enough patience. This is getting too technical. Doomed to failure. Thanks anyway.


If you didn't want a technical answer, why are you posting to a newsgroup that deals with the technical aspects of the language?
 
Reply With Quote
 
Tim Rentsch
Guest
Posts: n/a
 
      09-07-2012
Ben Bacarisse <(E-Mail Removed)> writes:

> pete <(E-Mail Removed)> writes:
>
>> Ben Bacarisse wrote:
>>>
>>> Bill Cunningham <(E-Mail Removed)> writes:

> <snip>
>>> > #include <stdio.h>
>>> > #include <stdlib.h>
>>> > #include <string.h>
>>> > static int
>>> > cmpstringp(const void *p1, const void *p2)
>>> > {
>>> > /* The actual arguments to this function are "pointers to
>>> > pointers to char", but strcmp(3) arguments are "pointers
>>> > to char", hence the following cast plus dereference */
>>> > return strcmp(* (char * const *) p1, * (char * const *) p2);
>>> > }

>>
>> I think that the way that the const keyword
>> is used in the return statement,
>> shows some confusion on the part of the author.
>>
>> It causes the result of the dereference
>> in the strcmp function call, to be const qualified,
>> which is neither required nor consistent
>> with the parameters of strcmp
>> being pointers to const qualified types.

>
> I am not so sure. The const that is there is a Good Const. Omitting it
> might cause a warning (gcc will oblige) about "casting away" const. The
> question as to whether there should be another:
>
> *(const char *const *)p1
>
> is not clear cut to me. The cast, as written, is a correct reflection
> of the object being sorted, and there is some documentary merit in doing
> that -- cast only to the type of the thing being sorted. [snip]


It is a correct reflection of the object being _compared_.
It is not a correct reflection of the object being _sorted_,
which must be writable so it can be moved within the larger
array.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
New releases: The Man With the Golden Arm, Cinderella Man & Dead & Buried; Updated complete downloadable R1 DVD DB & info lists Doug MacLean DVD Video 0 08-16-2005 05:35 AM
conflict between man perlipc and man perlfunc !? Jaap Karssenberg Perl Misc 0 01-09-2004 11:39 PM
[possibly OT] the comparison function in qsort Debashish Chakravarty C Programming 0 11-23-2003 04:59 AM
crashing qsort richard C Programming 34 08-28-2003 12:10 PM
Re: qsort and structs and ptrs richard C Programming 0 08-13-2003 11:09 PM



Advertisments