Re:Type-Safe Printf for C
by kazinator on Tuesday December 14, 2021 @05:48PM
(#29559199)
GCC has this also; this work is different because it removes the type errors. Instead of having an error like "%d expects a parameter of type int, not char ", it just lets %d print the string anyway. It's more like format* in Lisp, say:
Here ~d (decimal) doesn't care that it didn't get an integer.
[ Parent
| on HN ]
Re:Type-Safe Printf for C
by WalterBright on Tuesday December 14, 2021 @07:33PM
(#29560281)
For D's formatted write function, %s means "I don't care what type it is, just do the write thing with it" which works fine for nearly all uses.