On Sunday 03 February 2013 23:07:42 Kamil Dudka wrote: > diff --git a/find/exec.c b/find/exec.c > index aa69fe3..f731d82 100644 > --- a/find/exec.c > +++ b/find/exec.c > @@ -324,7 +324,7 @@ launch (struct buildcmd_control *ctl, void > *usercontext, int argc, char **argv) } > } > > - if (bc_args_exceed_testing_limit (argv)) > + if (bc_args_exceed_testing_limit ((const char **) argv)) > errno = E2BIG; > else > execvp (argv[0], argv);
As James pointed out, the above type-cast is insane because it might allow to assign a string literal to an item of an array of modifiable strings. If we want the compiler to check that bc_args_exceed_testing_limit() accesses the array of strings in a read-only manner, its prototype should be: bool bc_args_exceed_testing_limit (const char *const *argv); The problem is that such a type definition is actually useful in C++ only. For C compilers, we would need the explicit type-casts anyway. Hence, I propose to remove the const modifier from the bc_args_exceed_testing_limit() prototype completely because the C language does not seem to support the type-constraint we need. Here are some resources on this topic: http://c-faq.com/ansi/constmismatch.html http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49748 Does anyone have a better idea how to fix these warnings? Kamil
