October 08 [Issue 24800] New: pragma(printf) gives me the wrong fix | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=24800 Issue ID: 24800 Summary: pragma(printf) gives me the wrong fix Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: enhancement Priority: P1 Component: dmd Assignee: nobody@puremagic.com Reporter: schveiguy@gmail.com ```d printf("%s", 5); ``` produces the error: ``` Deprecation: argument `5` for format specification `"%s"` must be `char*`, not `int` ``` But the thing is, what if the 5 is not the problem? What if the problem is the %s? I propose the error message gets changed to: ``` Deprecation: argument `5` of type `int` does not match format specification `"%s"`. `"%s"` requires a `char*` parameter; `int` may be printed with `"%d"`. ``` Possibly, the compiler could list all the options for printing `int`, but this is enough to tell the user how to fix the problem. -- |
Copyright © 1999-2021 by the D Language Foundation