Notes from C++ static analysis

monarch_dodra monarchdodra at gmail.com
Thu Jun 27 01:05:28 PDT 2013


On Thursday, 27 June 2013 at 02:17:09 UTC, Andrei Alexandrescu 
wrote:
> On 6/26/13 1:31 PM, Andrej Mitrovic wrote:
>> On 6/26/13, Andrei Alexandrescu<SeeWebsiteForEmail at erdani.org>
>>  wrote:
>>> Actually this is good because it allows to customize the 
>>> format string
>>> to print only a subset of available information (I've 
>>> actually used this).
>>
>> Note that this works:
>>
>> writefln("%d", x, x);
>>
>> But the following throws since v2.061:
>>
>> writeln(format("%d", x, x));
>>
>> std.format.FormatException at C:\dmd-git\dmd2\windows\bin\..\..\src\phobos\std\string.d(2346):
>> Orphan format arguments: args[1..2]
>>
>> I find the latter to be quite useful for debugging code, and 
>> wanted
>> this feature for a long time.
>
> I think that's a bug in format that we need to fix.
>
> Andrei

I wanted to react on this: I'm surprised that writef and format 
*could* even have different behaviors (!) Don't both just forward 
to some sort of "format(sink, fmt, args...)" function that 
handles all the common code?

Or are there other subtle differences, bugs, where writef would 
produce different output from format?


More information about the Digitalmars-d mailing list