• 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: compiler warning
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: compiler warning


  • Subject: Re: compiler warning
  • From: "Alastair J.Houghton" <email@hidden>
  • Date: Tue, 5 Aug 2003 10:46:14 +0100

On Tuesday, August 5, 2003, at 07:55 am, Chuck Soper wrote:

I'm getting an "initialization discards qualifiers from pointer target type" warning for this line of code:
NSPointArray myPoints = [myMutableData bytes];

If I send mutableBytes to my NSMutableData object then I don't get a warning. Either way my application runs fine.

How can I avoid the warning from being generated? Thanks.

The reason is that NSData's -bytes method returns a const void * pointer, but NSPointArray isn't const qualified. You should write:

const NSPoint *myPoints = (const NSPoint *)[myMutableData bytes];

Kind regards,

Alastair.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >compiler warning (From: Chuck Soper <email@hidden>)

  • Prev by Date: Invoking command line commands with environment variables set
  • Next by Date: Re: Invoking command line commands with environment variables set
  • Previous by thread: compiler warning
  • Next by thread: NSDocumentController and multiple document types
  • Index(es):
    • Date
    • Thread