Notes from C++ static analysis

dennis luehring dl.soluz at gmx.net
Wed Jun 26 12:35:12 PDT 2013


Am 26.06.2013 21:07, schrieb Adam D. Ruppe:
> On Wednesday, 26 June 2013 at 18:54:17 UTC, H. S. Teoh wrote:
>>> import std.stdio;
>>> void main() {
>>>     size_t x = 10;
>>>     writefln("%d", x, x);
>>> }
>>>
>>> In a modern statically typed language I'd like such code to
>>> give a compile-time error.
>>
>> This looks like a bug to me. Please file one. :)
>
> Not necessarily, since you might want a format string to be a
> runtime variable, like when doing translations. I could live with
> there being another function that does runtime though.

then you normaly quote the % with %% or something else to inactivate it 
- thats much more clean then just to allow it for this corner case out 
of the box



More information about the Digitalmars-d mailing list