Should writef try to statically check for format specifiers?

bearophile bearophileHUGS at lycos.com
Tue Apr 12 12:27:39 PDT 2011


Andrej Mitrovic:

> I thought templated functions can be called without a bang if an
> argument can be deduced to be available at compile time. I know I've
> read about this somewhere, either TDPL or the docs. So I thought that
> writef checks the string literal at compile time, not runtime.

I think there is some confusion here. Each function call is done fully at compile time or fully at run time, there is no partial compilation. Template arguments always require the bang, and they are always taken at compile-time. Template functions may not require a bang+types if argument types can be inferred from the given arguments.

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list