Recommended way to use __FILE__/__LINE__ etc.

Andrey Zherikov andrey.zherikov at gmail.com
Thu Oct 22 15:32:57 UTC 2020


There are two ways how __FILE__, __LINE__ etc. can se used in 
function parameters: as regular parameters and as template 
parameters:

void rt(string file=__FILE__, int line=__LINE__, string 
func=__FUNCTION__)
{
     writeln(file,"(",line,"): ",func);
}

void ct(string file=__FILE__, int line=__LINE__, string 
func=__FUNCTION__)()
{
     writeln(file,"(",line,"): ",func);
}

What is recommended way?
What are pros/cons of each case?


More information about the Digitalmars-d-learn mailing list