std.logger
Jonathan M Davis
jmdavisProg at gmx.com
Fri Aug 23 13:08:40 PDT 2013
On Friday, August 23, 2013 21:47:44 Johannes Pfau wrote:
> 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?
Inlining will have no effect on __FILE__ and __LINE__, and it would be a bug if
it did, because they're supposed to give the file and line number of the source
code, whereas inlining only affects the generated binary.
- Jonathan M Davis
More information about the Digitalmars-d
mailing list