Sam James wrote:
> it's still going to be an issue if (as
> planned) Clang flips '-Wincompatible-pointer-types' to error out by
> default unless they carve out an exception for qualifiers here.
> 
> I'll advocate that they do, of course. I just came across it while
> checking for configure changes w/ recent GCC changes.

It's good if you have the time to test not-yet-released compiler versions.
I don't have that time, and therefore will prefer to wait until the
clang release is out.

If they really want to make an implicit assignment from 'const char *'
or 'volatile char *' to 'char *' an error, it will cause problems in
many packages, namely where argument arrays for calling exec* are
constructed: Since

  const char *argv[] = { "sh", "-c", "--", "pwd" };
  execv (argv[0], (char * const *) argv);

is dangerous (it violates the strict-aliasing rule), people write

  char *argv[] = { "sh", "-c", "--", "pwd" };
  execv (argv[0], argv);

And we don't want to write it as

  char *argv[] = { (char *) "sh", (char *) "-c", (char *) "--", (char *) "pwd" 
};
  execv (argv[0], argv);

because that is just silly.

Bruno




Reply via email to