Re: va_list and unanticipated format specifiers
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