By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,171 Members | 1,037 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,171 IT Pros & Developers. It's quick & easy.

declaration Q

P: n/a
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?
Dec 8 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
CptDondo wrote:
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.

Dec 8 '05 #2

P: n/a
On Thu, 08 Dec 2005 11:02:32 -0800, tedu wrote:
int ysfilter (struct dirent *dir);


missing const here.


DUH! Thanks. I got so focused on the function type that I didn't check
the args....
Dec 9 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.