Article View: comp.lang.c.moderated
Article #2507Re: Annotations on K&R II
From: Claude Quezel
Date: Fri, 05 Apr 1996 00:39
Date: Fri, 05 Apr 1996 00:39
41 lines
1782 bytes
1782 bytes
Konrad Schwarz wrote:
[stuff left out]
> This is the reason why casting the comparison function argument
> of qsort to a function of two void pointers even if the actual argument
> is a function of two pointers to non-void is non-conforming, since the
> compiler now has no place to insert the pointer-conversion code.
I am not sure I understand this. Is that this code is illegal?
[Well, the //'s are illegal, because they're a syntax error... -mod]
int comp(const type* p1, const type* p2) {
// logic here
}
type array[size];
qsort(array, sizeof(array)/sizeof(array[0]), sizeof(array[0]),
(int(*)(const void*, const void*)) comp);
and that this is?
int comp(const void* p1, const void* p2) {
// logic here with ((type*) p1) and ((type*) p2)
}
type array[size];
qsort(array, sizeof(array)/sizeof(array[0]), sizeof(array[0]), comp);
------------------------------------------------------------------
" When I use MS Word 6.0 on a PC running windows 3.1 and DOS 6.0
and write a normal plain english letter, The Tools/Languages ...
option never works. It never succeeded in translating ( in any
languages). This is a serious bug. "
------------------------------------------------------------------
Technical Details
Message-ID:
<4k1q3b$5b1@solutions.solon.com>Path:
arc1-ca.pugleaf.net!solon.com!not-for-mailReferences:
<4jq1eq$a3c@solutions.solon.com> <4jr73o$h87@solutions.solon.com> <4jv6o8$coj@solutions.solon.com>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!solon.com!not-for-mail From: Claude Quezel <Claude.Quezel@gci.ulaval.ca> Newsgroups: comp.lang.c.moderated Subject: Re: Annotations on K&R II Date: 4 Apr 1996 18:39:06 -0600 Organization: Universite Laval Sender: clc@solutions.solon.com Approved: clc@solutions.solon.com Message-ID: <4k1q3b$5b1@solutions.solon.com> References: <4jq1eq$a3c@solutions.solon.com> <4jr73o$h87@solutions.solon.com> <4jv6o8$coj@solutions.solon.com> NNTP-Posting-Host: solutions.solon.com X-Mailer: Mozilla 2.0 (Win16; I)