|
|
|
|
|
by scatters
2016 days ago
|
|
"printf" isn't magical, it's a standard va_args function. There's plenty of ugliness in the implementation [1] (so many macros!) but that's to be expected from something that has to simultaneously parse a format string and format output. The only magic is around format string checking. 1. https://github.com/bminor/glibc/blob/glibc-2.32/stdio-common... |
|
Also the compiler is likely to optimise most calls to printf, transforming them into calls to other functions like puts [0], or apparently [1] even to fwrite. Probably doesn't count as magic, but almost.
[0] https://stackoverflow.com/q/44406798/
[1] https://news.ycombinator.com/item?id=23308893