Date: Mon, 29 May 2006 13:23:36 +0400 From: Yar Tikhiy <yar@comp.chem.msu.su> To: freebsd-arch@freebsd.org Subject: Re: Can fts_open() be constified further? Message-ID: <20060529092335.GD98288@comp.chem.msu.su> In-Reply-To: <20060528164328.GA84031@comp.chem.msu.su> References: <20060528164328.GA84031@comp.chem.msu.su>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20060529092335.GD98288>