Am 29.08.2009 um 21:19 schrieb Quincey Morris:
So if you provide a string literal, there's no warning because it's assumed you're not going to hard-code stray '%' characters in it. If you provide arguments after the string (whether literal or not), it's assumed you've made sure the string really is a format string. If you provide a non-ilteral string and no arguments, there's a fair chance that you've forgotten that some potential string values will blow up, hence the warning.

 It's not a bug in most cases mentioned here:

If you have no arguments, you should be using puts() instead of printf () and fputs() instead of fprintf() (or in the case of +stringWithFormat:, use +stringWithString:, or just copy or retain the string, or use it directly).

In the case of NSLog(), use a constant format string (at least @"%@") instead of passing a string.

It seems the only case it's really a bug is NSLog(), because there's no variant of NSLog() without a format string, and as someone else posted here, it's apparently an undesired interaction with -fno- constant-strings, so file a bug.

Cheers,
-- Uli Kusterer
"The Witnesses of TeachText are everywhere..."
http://www.zathras.de





_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to