• 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: va_list and unanticipated format specifiers
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: va_list and unanticipated format specifiers


  • Subject: Re: va_list and unanticipated format specifiers
  • From: Ken Thomases <email@hidden>
  • Date: Fri, 4 Jun 2010 16:22:23 -0500

On Jun 4, 2010, at 8:34 AM, email@hidden wrote:

> Thanks for persisting Ken.

You're welcome.

> In general it would seem that when a  method/function has format + va_list signature
> invocations should not contain single variable argument lists.

> The following regex is reasonably effective at finding the issue:
> NSLog\([^@]

The compiler will actually find this for you.  Enabling -Wformat (which is included in -Wall) issues warnings for functions and methods that take format strings if you supply a non-literal format argument and no arguments.  If you supply a literal format string, then the compiler checks the format specifiers in it against the types of the arguments you pass.  If there's a mismatch in number or type, it warns for that, too.

The current SDKs decorate such functions and methods in Cocoa with the attribute marking them as such.  (The compiler automatically knows about C library functions, like printf.)

Cheers,
Ken

_______________________________________________

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: va_list and unanticipated format specifiers
      • From: "email@hidden" <email@hidden>
References: 
 >va_list and unanticipated format specifiers (From: "email@hidden" <email@hidden>)
 >Re: va_list and unanticipated format specifiers (From: Ken Thomases <email@hidden>)
 >Re: va_list and unanticipated format specifiers (From: "email@hidden" <email@hidden>)
 >Re: va_list and unanticipated format specifiers (From: Ken Thomases <email@hidden>)
 >Re: va_list and unanticipated format specifiers (From: "email@hidden" <email@hidden>)

  • Prev by Date: Re: Newbie Question re: callback signatures
  • Next by Date: Re: va_list and unanticipated format specifiers
  • Previous by thread: Re: va_list and unanticipated format specifiers
  • Next by thread: Re: va_list and unanticipated format specifiers
  • Index(es):
    • Date
    • Thread