|
|
|
|
|
by trealira
617 days ago
|
|
Ironically, in K&R, they did exactly this for casting comparator functions for their own version of qsort. /* declarations */
void qsort(void *lineptr[], int left, int right,
int (*comp)(void *, void *));
int numcmp(char *, char *);
/* the offending line */
qsort((void **) lineptr, 0, nlines-1,
(int (*)(void*,void*)(numeric ? numcmp : strcmp));
|
|
In the GP example, a char** is passed where a char* is expected. That is clearly invalid.