Thread overview | ||||||
---|---|---|---|---|---|---|
|
February 03, 2021 [Issue 21605] Instead of giving error on printf format mismatch, correct it | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=21605 Mathias LANG <pro.mathias.lang@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |pro.mathias.lang@gmail.com --- Comment #1 from Mathias LANG <pro.mathias.lang@gmail.com> --- That sounds like a lot of magic for `printf`. What's the advantage over using, say, `writeln` ? And if it's only `-betterC` then it's rather simple to provide a library implementation that calls `printf` under the hood, no need to add this in the compiler. -- |
February 03, 2021 [Issue 21605] Instead of giving error on printf format mismatch, correct it | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=21605 Dennis <dkorpel@live.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |dkorpel@live.nl --- Comment #2 from Dennis <dkorpel@live.nl> --- I would not want to rely on compiler magic to rewrite a faulty format string into a correct one. You even said yourself: > I used to write macros in C named "printf" that would muck about with the arguments, add some logic, then call the real printf. After a few years I got tired of them, and put them in a bag with some rocks and threw it in the swamp. https://forum.dlang.org/post/rv5idj$1all$1@digitalmars.com > It's kinda trivially obvious that someone can write their own functions to do things, but pretending it is printf by naming it printf just puts a layer of confusion in for the reader. printf is so ubiquitous that it brings expectations when saying printf can be called that printf is actually being called, rather than some intermediary one must write oneself. https://forum.dlang.org/post/rv5fln$14n2$1@digitalmars.com This is essentially such an intermediary function, only it's always inlined and implemented in the compiler. Ways this could backfire are: - The code is compiled with an older D compiler that doesn't apply the fix - printf arguments are copied to a third party 'my_printf' function that is not annotated with pragma(printf) - Someone unaware of D's printf magic translates D code to C Proposing the correct format specifier for the type (instead of only the correct type for the format specifier) in the error message seems like a good idea. -- |
December 17, 2022 [Issue 21605] Instead of giving error on printf format mismatch, correct it | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=21605 Iain Buclaw <ibuclaw@gdcproject.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Priority|P1 |P4 -- |
September 03 [Issue 21605] Instead of giving error on printf format mismatch, correct it | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=21605 Walter Bright <bugzilla@digitalmars.com> changed: What |Removed |Added ---------------------------------------------------------------------------- See Also| |https://issues.dlang.org/sh | |ow_bug.cgi?id=24133 -- |
Copyright © 1999-2021 by the D Language Foundation