This is the mail archive of the
mailing list for the GCC project.
Re: [RFC] warning: initialization discards qualifiers from pointer target type
On Apr 18, 2005, at 6:29 PM, James E Wilson wrote:
This seems rather unlikely to be an accident.
I agree, I'm sure it was due to bad system header files, only some of
which had const and others didn't. By ignoring the issue in the
compiler, the compiler works on such (broken) systems. The usual
case I think was a system that had a compiler that did const, but the
OS hadn't added it yet, but people built software that made use of
const, and presto, it wouldn't compile. In the C++ world, we did the
same thing (we used warning as I recall) for a long time, but that
was due to bugs in the compiler, where const wasn't propagated around
correctly internally, so, instead of pestering the user with error
messages they could not fix, we just made it a warning by default.
The idea was eventually we'd weed them all out and make it an error;
today, it is an error.
I notice that these are pedwarns, not a warning as in the -Wcast-
qual case, which means that the ISO C standard requires a
diagnostic here. For this reason, it may not be wise to add an
option to disable the warnings. You may lose portability to other
If we had a framework for disabling warnings.... it probably would
just fit into it. :-)