declaration Q

C

CptDondo

I've got an issue that I can't figure out.... It has to do with a
compiler warning:

warning: passing arg 3 of `scandir' from incompatible pointer type

Now scandir is declared in dirent.h:

extern int scandir (__const char *__restrict __dir,
struct dirent ***__restrict __namelist,
int (*__selector) (__const struct dirent *),
int (*__cmp) (__const void *, __const void *));

I am calling it as follows:

n = scandir ("/data/pictures", &namelist, ysfilter, alphasort);

and my 3rd argument (ysfilter) is declared as follows:

int ysfilter (struct dirent *dir);

The 4th argument is

extern int alphasort (__const void *__e1, __const void *__e2)
__THROW __attribute_pure__;

so they should be both the same....

I must be blind.... Or I'm missing something really obvious.

Why am I getting a warning?
 
T

tedu

CptDondo said:
I've got an issue that I can't figure out.... It has to do with a
compiler warning:

warning: passing arg 3 of `scandir' from incompatible pointer type

Now scandir is declared in dirent.h:

extern int scandir (__const char *__restrict __dir,
struct dirent ***__restrict __namelist,
int (*__selector) (__const struct dirent *),
int (*__cmp) (__const void *, __const void *));

I am calling it as follows:

n = scandir ("/data/pictures", &namelist, ysfilter, alphasort);

and my 3rd argument (ysfilter) is declared as follows:

int ysfilter (struct dirent *dir);

missing const here.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,043
Latest member
CannalabsCBDReview

Latest Threads

Top