modulename

Andrej Mitrovic andrej.mitrovich at gmail.com
Wed Sep 5 11:46:08 PDT 2012


On 9/5/12, Jonathan M Davis <jmdavisProg at gmx.com> wrote:
> Regardless of whether it works, __FILE__ and __LINE__ should be used as
> template arguments with extreme caution, because you end up with a new
> instantiation for _every_ use (at least if you use both together).

Honestly it would be much better if the file and line were symbols you
could retrieve at any point in your function, e.g.:

void foo()
{
    string file = __FILE__;  // file of inside
    int line = __LINE__;  // line inside foo

    string callFile = __INFILE__;  // file of invocation
    int line = __INLINE__;  // line of invocation
}

That way you don't have to mess with your CT/RT parameters if all you
want to do is printf-style debugging.


More information about the Digitalmars-d-learn mailing list