Can fts_open() be constified further?

Yar Tikhiy yar at comp.chem.msu.su
Mon May 29 02:23:55 PDT 2006


On Sun, May 28, 2006 at 08:43:28PM +0400, Yar Tikhiy wrote:
> Hi folks,
> 
> Currently, fts_open() is declared as follows:
> 
>      FTS *
>      fts_open(char * const *path_argv, int options,
>          int (*compar)(const FTSENT * const *, const FTSENT * const *));
> 
> This means that one cannot pass pointers to constant strings in
> path_argv[] without getting rather justified warnings from cc.
> AFAIK, fts(3) functions aren't supposed to modify the path strings.
> Hence the prototype asks to be changed slightly:
> 
>      fts_open(const char * const *path_argv, int options,
>               ^^^^^
> This shouldn't break fts consumers because a pointer to a variable
> can be converted to a pointer to a constant w/o warnings (but not
> the other way around.)  Can anybody see other possible side effects
> from such change?

I was pointed out in a private mail that the types "const FOO **"
and "FOO **" were incompatible, which would break passing "argv"
from main() to fts_open().

-- 
Yar


More information about the freebsd-arch mailing list