Re: NSString format specifiers (was: Is Concatenation that complex?)
Re: NSString format specifiers (was: Is Concatenation that complex?)
- Subject: Re: NSString format specifiers (was: Is Concatenation that complex?)
- From: Allan Odgaard <email@hidden>
- Date: Wed, 28 Apr 2004 05:38:06 +0200
On 28. Apr 2004, at 4:31, Louis C. Sacha wrote:
[...] Maybe if they would document their supported format
specifiers/placeholders, I would know wether or not this is a bug ;)
The supported format specifiers are documented [...]
I stand corrected! Thanks a lot for the pointer. I was looking at
CFStringCreateWithFormat (since CoreFoundation is usually the place to
turn for more info) which says: ;For more information on supported
specifiers, see the relevant section in the Programming Topic
Strings.+ -- but reading more or less all the articles in the
"Strings" topic just gave me:
As mentioned earlier, the format string has
printf-style specifiers embedded in it (for
example, %d %s %2.2f). Core Foundation
introduces a couple of extensions to this
convention. One is the %@ specifier (shown in
Listing 3) which indicates any Core Foundation
object. Another new specifier indicates argument
order. This specifier takes the form n$ where n
is the order-number of the argument following the
string.
As far as %z, it doesn't appear to be an ANSI C format specifier, so I
guess that would fall under the category of enhancement request as
well :)
I have it from "man 3 printf" which says:
STANDARDS
Subject to the caveats noted in the BUGS section below, the
fprintf(),
printf(), sprintf(), vprintf(), vfprintf(), and vsprintf()
functions con-
form to ANSI X3.159-1989 (``ANSI C'') and ISO/IEC 9899:1999
(``ISO C99''). With the same reservation, the snprintf() and
vsnprintf()
functions conform to ISO/IEC 9899:1999 (``ISO C99'').
BUGS
[...] The conversion formats %D, %O, and %U are not standard
and are provided only for backward compatibility [...]
I do not have the ANSI-C standard, so I do not know what to put into
this. But googling for the subject turned up:
http://h21007.www2.hp.com/dspp/tech/tech_TechSingleTipDetailPage_IDX/
1,2366,198,00.html which says:
How to portably print pointers and size_t values
[...] Fortunately, ANSI C provides printf format
specifiers that solve this problem cleanly [...]
Values of type size_t should use the Z size
modifier [...]
I will make a feature request about it, then we'll see how Apple feels
about it ;)
--
et al: used as an abbreviation when referring to a number of people, for
example: "It has been improved by Knuth et al." [syn: and others, et
alii]
etc: continuing in the same way [syn: and so forth, and so on, et
cetera].
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.