Mail Archives: djgpp/1997/11/14/09:16:31
From: | e-mail DOT address AT end DOT of DOT text (Mike Collins)
|
Newsgroups: | comp.os.msdos.djgpp
|
Subject: | Compiler warning - bad parameter
|
Date: | 14 Nov 1997 10:57:18 GMT
|
Organization: | Storage Technology Limited
|
Lines: | 54
|
Message-ID: | <64haqf$ks1@news.network.com>
|
NNTP-Posting-Host: | 129.80.172.92
|
Mime-Version: | 1.0
|
To: | djgpp AT delorie DOT com
|
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp
|
Folks,
I am writing a program which involves qsort(). When I compile it, I get a
warning message :
Compiling: test2.c
In function `main':
test2.c(19) Warning: passing arg 4 of `qsort' from incompatible pointer type
no errors
The program runs fine, though not in the "bare-bones" form below, of course.
This is simply the minimum program that still gives the compile warning.
I want to get rid of the warning, but though I have tried a lot of different
things, I can't see where the incompatibility in the pointers lies. Another
compiler does not give any warning.
Can you help?
Mike.
The program is below:
#include <stdio.h>
struct BOOKER_ITEM
{ char refnum[7];
};
// func definition pulled out of <stdlib.h>
void qsort(void *_base, size_t _nelem, size_t _size,
int (*_cmp)(const void *_e1, const void *_e2));
int comp_ref(struct BOOKER_ITEM *s1, struct BOOKER_ITEM *s2);
main()
{
int known_records;
struct BOOKER_ITEM *book_lst;
qsort(book_lst, known_records, sizeof(struct BOOKER_ITEM), comp_ref);
}
int comp_ref(struct BOOKER_ITEM *s1, struct BOOKER_ITEM *s2)
{ return strncmp(s1->refnum, s2->refnum, sizeof(s1->refnum));
}
--
Don't just hit "reply" - my E-mail address is bogus
to avoid automatic browsers from sending junk mail.
Please use collim'at'europe'dot'stortek'dot'com
Actually, even this doesn't stop all of them ...
- Raw text -