David C. Rankin wrote:
Cristian, Andreas, All,
I have stumbled across another potential warning in the qsort example of the libc manual that could be addressed in the 2.16 release. Sections 9.3 (qsort) and section 9.4 (muppet example of qsort) provide example of qsort. However, on compile, incompatible pointer type warnings are received. (test on 11.4)
09:20 alchemy:~/dev/prg/ccpp/src-c/misc> gcc -Wall -o qsortmup qsort-muppets.c qsort-muppets.c: In function ‘find_critter’: qsort-muppets.c:62:7: warning: passing argument 5 of ‘bsearch’ from incompatible pointer type /usr/include/stdlib.h:750:14: note: expected ‘__compar_fn_t’ but argument is of type ‘int (*)(const struct critter *, const struct critter *)’ qsort-muppets.c: In function ‘main’: qsort-muppets.c:80:41: warning: passing argument 4 of ‘qsort’ from incompatible pointer type /usr/include/stdlib.h:756:13: note: expected ‘__compar_fn_t’ but argument is of type ‘int (*)(const struct critter *, const struct critter *)’
Wild guess - either use __compar_fn_t when you define the comparison function, or define it to use void* as arguments. -- Per Jessen, Zürich (6.8°C) -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org