std.logger

Johannes Pfau nospam at example.com
Fri Aug 23 12:47:44 PDT 2013


Am Fri, 23 Aug 2013 15:16:05 -0400
schrieb "Jonathan M Davis" <jmdavisProg at gmx.com>:

> On Friday, August 23, 2013 19:21:33 Gary Willoughby wrote:
> > I don't think you can bloat a simple logger too much with
> > templates. It's a pretty simple framework.
> 
> If __FILE__ and __LINE__ are template arguments to a logging function
> rather than function arguments (and you can't make __FILE__ and
> __LINE__ default function arguments if the function is variadic as it
> would have to be to support format strings), then you get a new
> template instantation every single time that you call the function,
> unless you call it more than once on the same line (which you're
> unlikely to ever do).
> 
> I want to think that there's a way to handle this if you get clever,
> but I can't think of a clever way to get around the problem at the
> moment.
> 
> - Jonathan M Davis

Make the templated function a stub which redirects to a function which
uses normal function arguments and rely on inlining?


More information about the Digitalmars-d mailing list