Compile time format string check

Ada notemail at not.com
Mon Mar 23 05:29:27 UTC 2026


On Sunday, 22 March 2026 at 22:49:24 UTC, Richard (Rikki) Andrew 
Cattermole wrote:
> If its a string literal it is already handled as part of 
> bindings: https://dlang.org/spec/pragma.html#printf
>
> I understand that you may be wanting a runtime error, but I'd 
> suggest disallowing that entirely and go with a template 
> parameter to provide your format to make sure its seeable to 
> the compiler.

I clearly said compile-time. maybe you misspoke.
It's a bit of a nuisance because the function call then doesn't 
resemble C that much anymore. (it's called betterc)

Can you help me rewrite my code to properly verify that the 
format specifiers match the arguments?
If it's possible without templates, otherwise with templates.


More information about the Digitalmars-d-learn mailing list