• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: gcc4.0 and -Wcast-qual
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: gcc4.0 and -Wcast-qual
      • From: Dmitry Markman <email@hidden>
References: 
 >gcc4.0 and -Wcast-qual (From: Dmitry Markman <email@hidden>)

  • Prev by Date: Re: xCode not finding header files of included frameworks
  • Next by Date: Re: gcc4.0 and -Wcast-qual
  • Previous by thread: gcc4.0 and -Wcast-qual
  • Next by thread: Re: gcc4.0 and -Wcast-qual
  • Index(es):
    • Date
    • Thread