Bug 24800 – pragma(printf) gives me the wrong fix

Status
NEW
Severity
enhancement
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2024-10-08T15:53:52Z
Last change time
2024-12-13T19:37:57Z
Assigned to
No Owner
Creator
Steven Schveighoffer
Moved to GitHub: dmd#20528 →

Comments

Comment #0 by schveiguy — 2024-10-08T15:53:52Z
```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.
Comment #1 by robert.schadek — 2024-12-13T19:37:57Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/20528 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB