Evaluating __FILE__ and __LINE__ of caller?

H. S. Teoh hsteoh at quickfur.ath.cx
Fri Mar 2 19:25:19 PST 2012


On Sat, Mar 03, 2012 at 03:33:46AM +0100, Adam D. Ruppe wrote:
> On Saturday, 3 March 2012 at 02:19:55 UTC, Andrej Mitrovic wrote:
> >Right, but what about template bloat?
> 
> You don't have to use templates at all. The __FILE__
> and __LINE__ default params work in regular functions.
> 
>             // not a template, just regular parameters
> void awesome(string file = __FILE__, int line = __LINE__) {
>         printf("called from %s:%d", file, line);
> }
[...]

Cool! Thanks!


T

-- 
"Outlook not so good." That magic 8-ball knows everything! I'll ask
about Exchange Server next. -- (Stolen from the net)


More information about the Digitalmars-d-learn mailing list