| printf is a bad joke of a formatting function. When i want to print a string i don't want to worry about the security implications of that. With printf i have to. [0] And i certainly don't want a turing complete contraption. [1] Also looking at log4j. And even if everything is correct, it's has to parse a string at runtime. I consider that alone unaesthetic. >Edit: It's almost like the whole world got a lot of work done with the tools they already had. The best metaphor i know for this attitude is "stacking chairs to reach to moon". If you don't care about the limits of the tech you will be stuck within it. I'm time and time again amused how anti intellectual and outright hostile to technological progress the programming profession is. programmers, out of all of them. [0] https://cve.mitre.org/cgi-bin/cvekey.cgi?keyword=printf [1] https://news.ycombinator.com/item?id=25691598 |
Technically, it doesn’t have to do that. If a program includes the header declaring printf using the <> header defined in the standard and then calls printf the compiler is allowed to assume that the printf that the program will be linked to will behave according to the standard, and need not compile a call to printf. It can generate code that behaves identically.
A simple example is gcc converting a printf with a constant string to a puts call (https://stackoverflow.com/questions/25816659/can-printf-get-...)