Notes from C++ static analysis

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Wed Jun 26 23:47:15 PDT 2013


On 6/26/13 8:36 PM, Jonathan M Davis wrote:
> On Wednesday, June 26, 2013 19:18:27 Andrei Alexandrescu wrote:
>> On 6/26/13 1:50 PM, bearophile wrote:
>>> Andrei Alexandrescu:
>>>> 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).
>>>
>>> Your use case is a special case that breaks a general rule.
>>
>> There's no special case here.
>
> I have never heard anyone other than you even suggest this sort of behavior.
> Granted, I may just not talk with the right people, but that at least makes it
> sound like what you're suggesting is a very special case.

I'm not surprised. Not many people deal with things like localization or 
internalization.

>>> That
>>> behavour is surprising, and it risks hiding some information silently.
>>
>> Doesn't surprise me one bit.
>
> Well, it shocks most of us.

I'm also not moved by argumentum ad populum.

> We expect the number of arguments to a function to
> match the number of parameters, and with format strings, you're basically
> declaring what the parameters are, and then the other arguments to format or
> writefln are the arguments to the format string. Most of us don't even think
> about swapping out the format string at runtime.

That is the smoking gun.


Andrei



More information about the Digitalmars-d mailing list