Re: gcc4.0 and -Wcast-qual
Re: gcc4.0 and -Wcast-qual
- Subject: Re: gcc4.0 and -Wcast-qual
- From: David Fang <email@hidden>
- Date: Thu, 3 Nov 2005 20:50:22 -0500 (EST)
Hi,
Ouch, this doesn't look good. I was able to write a similar two
line example:
const int foo[2] = {1,1};
((int*)foo)[0] = 0;
which was accepted with -Wcast-qual by Apple-g++ 4.0.0, and FSF g++-4.0.2.
g++-3.3 rejects it as we'd expect. (and I depend on warnings to catch
such evil in my code (-Werror)!) Consider filing a report to
http://gcc.gnu.org/bugzilla/?
> /usr/bin/gcc-3.3 -c main.cpp -Wcast-qual
>
> returns
> main.cpp: In function `int main(int, char**)':
> main.cpp:8: warning: cast from `const char*' to `char*' discards
> qualifiers
> from pointer target type
>
> gcc -c main.cpp -Wcast-qual
> returns nothing,
>
> I'm talking about 10.4.3 and XCode 2.1 so default compiler is gcc 4.0.0
>
> Dmitry Markman
David Fang
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden