Notes from C++ static analysis
Andrei Alexandrescu
SeeWebsiteForEmail at erdani.org
Wed Jun 26 23:49:41 PDT 2013
On 6/26/13 10:35 PM, Peter Williams wrote:
> On 27/06/13 14:20, H. S. Teoh wrote:
>> On Thu, Jun 27, 2013 at 01:56:31PM +1000, Peter Williams wrote:
>> [...]
>>> While you're fixing it can you modify it so that the format string
>>> can specify the order in which the arguments are replaced? This is
>>> very important for i18n. I apologize if it can already do this but
>>> I was unable to find any documentation of format()'s format string
>>> other than examples with %s at the appropriate places.
>> [...]
>>
>> You can use positional arguments for this purpose. For example:
>>
>> writefln("%2$s %1$s", "a", "b");
>>
>> outputs "b a".
>
> Yes, I eventually found the documentation in std.format while I expected
> it to be in std.string along with the documentation the format()
> function. A reference to std.format in the documentation for format()
> (in std.string) would be nice.
The only point I'd negotiate would be to not throw with positional
arguments, and throw with sequential arguments. All code that cares uses
positional specifiers anyway.
Andrei
More information about the Digitalmars-d
mailing list