On Monday, April 17, 2017 10:58:36 Basile B. via Digitalmars-d-learn wrote: > 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.
It doesn't in C++ (which is _really_ annoying), but it does in D. In C++, it uses the file and line number of the declaration site, whereas in D, it uses the file and line number of the call site. - Jonathan M Davis