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?
|
|
0
|
|
|
|
Reply
|
yan (1418)
|
12/8/2005 6:57:52 PM |
|
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.
|
|
0
|
|
|
|
Reply
|
tu102 (102)
|
12/8/2005 7:02:32 PM
|
|
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....
|
|
0
|
|
|
|
Reply
|
yan (1418)
|
12/9/2005 4:12:26 AM
|
|