3 ms·
"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
by scatters 6y 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/vfprintf-internal.c#L1320 https://github.com/bminor/glibc/blob/glibc-2.32/stdio-common...
- MaxBarraclough 6y ago> The only magic is around format string checking 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/ https://stackoverflow.com/q/44406798/ [1] https://news.ycombinator.com/item?id=23308893 https://news.ycombinator.com/item?id=23308893