• 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: How to fix warning?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to fix warning?


  • Subject: Re: How to fix warning?
  • From: Tom Davie <email@hidden>
  • Date: Wed, 28 Aug 2013 22:30:06 +0200

On 28 Aug 2013, at 22:26, Dave <email@hidden> wrote:

> Hi,
>
> I am getting the following warning
>
> warning: format specifies type 'unsigned short' but the argument has type 'int' [-Wformat]
>
> on this statement:
>
> NSCharacterSet *stopCharacters = [NSCharacterSet characterSetWithCharactersInString:[NSString stringWithFormat:@"< \t\n\r%C%C%C%C", 0x0085, 0x000C, 0x2028, 0x2029]];
>
> What is the best way to fix this?

The type of integer literals in C is “int” by default.  If you want them to be shorts (or unsigned, as is the bigger issue in this case), you must cast them either explicitly (by adding the casts in this expression), or implicitly, by assigning the littorals to a variable of the desired type.

Tom Davie


_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


  • Follow-Ups:
    • Re: How to fix warning?
      • From: Boyd Collier <email@hidden>
References: 
 >How to fix warning? (From: Dave <email@hidden>)

  • Prev by Date: How to fix warning?
  • Next by Date: Re: "Introducing ioscomponents.com"
  • Previous by thread: How to fix warning?
  • Next by thread: Re: How to fix warning?
  • Index(es):
    • Date
    • Thread