Re: compile-time checked format strings

2018-01-13 Thread kdevel via Digitalmars-d-learn
On Saturday, 13 January 2018 at 19:40:09 UTC, Adam D. Ruppe wrote: For ints, it catches all that, but for float, it just bails out of the check as soon as it actually *succeeds* - because that kills CTFE. Confirmed. Thanks! args.d ``` import std.stdio; void main () { // writefln!"%2.2d %2.

Re: compile-time checked format strings

2018-01-13 Thread Basile B. via Digitalmars-d-learn
On Saturday, 13 January 2018 at 19:40:09 UTC, Adam D. Ruppe wrote: On Saturday, 13 January 2018 at 19:15:49 UTC, kdevel wrote: dmd checks the types but does not count the arguments. so note that dmd doesn't actually do any checks here - it is all done in library code. The implementation is

Re: compile-time checked format strings

2018-01-13 Thread Adam D. Ruppe via Digitalmars-d-learn
On Saturday, 13 January 2018 at 19:15:49 UTC, kdevel wrote: dmd checks the types but does not count the arguments. so note that dmd doesn't actually do any checks here - it is all done in library code. The implementation is amusingly simple: https://github.com/dlang/phobos/blob/master/std/fo

compile-time checked format strings

2018-01-13 Thread kdevel via Digitalmars-d-learn
occasion: http://forum.dlang.org/thread/mutegviphsjwqzqfo...@forum.dlang.org?page=3#post-mailman.2136.1515709204.9493.digitalmars-d-announce:40puremagic.com dmd checks the types but does not count the arguments. ctcfs.d ``` import std.stdio; import std.math; void unit (T) () { auto pi = 4 *