• 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: -Wformat only warns about NSInteger as printf param in 32-bit builds
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: -Wformat only warns about NSInteger as printf param in 32-bit builds


  • Subject: Re: -Wformat only warns about NSInteger as printf param in 32-bit builds
  • From: Carl Hoefs <email@hidden>
  • Date: Tue, 02 Feb 2016 15:27:03 -0700

On Feb 2, 2016, at 12:45 PM, Jens Alfke <email@hidden> wrote:

error: values of type 'NSInteger' should not be used as format arguments; add an explicit cast to 'long' instead

Yeah, it's sort of a hopeless situation:

#if __LP64__ || (TARGET_OS_EMBEDDED && !TARGET_OS_IPHONE) || TARGET_OS_WIN32 || NS_BUILD_32_LIKE_64
  typedef long NSInteger;
  typedef unsigned long NSUInteger;
#else
  typedef int NSInteger;
  typedef unsigned int NSUInteger;
#endif


FWIW, I get the same complaint about using UInt32 and SInt32-type variables, for the same reasons.

error: values of type 'UInt32' should not be used as format arguments; add an explicit cast to 'unsigned int' instead
error: values of type 'SInt32' should not be used as format arguments; add an explicit cast to 'int' instead

-Carl

 _______________________________________________
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

References: 
 >-Wformat only warns about NSInteger as printf param in 32-bit builds (From: Jens Alfke <email@hidden>)

  • Prev by Date: -Wformat only warns about NSInteger as printf param in 32-bit builds
  • Next by Date: Re: -Wformat only warns about NSInteger as printf param in 32-bit builds
  • Previous by thread: -Wformat only warns about NSInteger as printf param in 32-bit builds
  • Next by thread: Re: -Wformat only warns about NSInteger as printf param in 32-bit builds
  • Index(es):
    • Date
    • Thread