Voting: std.logger

Timon Gehr via Digitalmars-d digitalmars-d at puremagic.com
Wed Sep 10 11:46:31 PDT 2014


On 09/10/2014 08:18 PM, Sönke Ludwig wrote:
> Am 10.09.2014 17:41, schrieb Timon Gehr:
>> On 09/10/2014 03:22 PM, Daniel Murphy wrote:
>>> "Jacob Carlborg"  wrote in message news:lupda8$nl1$1 at digitalmars.com...
>>>> Could we modify the compiler to allow that? Just for the special
>>>> identifiers __LINE__, __FILE__ and similar. It wouldn't be possible to
>>>> specify a value for that parameter then.
>>>
>>> IIRC Andrei has a bugzilla open for this.
>>
>> Why? I cannot remember a compiler version where the following did not
>> work:
>>
>> import std.stdio;
>> void fun(A...)(A args, int l = __LINE__){ writeln(args," ",l); }
>> void main(){ fun(1,2,3); }
>>
>> I.e. there is absolutely no issue here.
>
> Except that it unfortunately doesn't do what is intended:
>
> import std.stdio;
> void fun(A...)(A args, int l = __LINE__){ writeln(args," ",l); }
> void main(){ fun(10,11); }
>
> output:
> 10 11
>
> expected:
> 1011 3

Oops! Touché! Thanks. While the code indeed works, there actually _is_ 
an issue here. :o)

(It is even more embarrassing seeing that I have actually built my own 
implementation of IFTI and it actually matches DMD's behaviour in this 
case.)


More information about the Digitalmars-d mailing list