hidden passing of __FILE__ and __LINE__ into function

Basile B. via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Apr 17 03:58:36 PDT 2017


On Monday, 17 April 2017 at 10:55:30 UTC, Jonathan M Davis wrote:
> On Monday, April 17, 2017 10:30:35 Basile B. via 
> Digitalmars-d-learn wrote:
>> On Monday, 17 April 2017 at 10:22:47 UTC, Dmitry wrote:
> void error(string msg, string file = __FILE__, size_t line = 
> __LINE__)
> {
>     ...
> }
>
> That's what Exception's constructor does as well as functions 
> like std.exception.enforce.
>
> - Jonathan M Davis

I didn't know that this also works for regular parameters. Then 
it's obviously better.


More information about the Digitalmars-d-learn mailing list