Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

printf

Man, when I first read about it I was like “whaaaaa???” A little interpreted language in my print statements? That’s crazy talk!

Now it’s like ... everywhere!




I feel it’s worth giving credit to Python f-strings in that case. They blew my mind in terms of convenience vs printf.


Python has a few cool things like that. List comprehension blows my mind at how elegant it is.


Agreed. Same with dict, set and generator comprehensions. I wish more languages included that feature.


In addition to Python format strings: Javascript template strings:

`I am ${variable.foo} ${variable.bar}.` - Life changing!


Wait til you try scanf


What year did reaction happen? I spent my entire life taking it for granted, not realizing that it indeed is a little interpreted language in print statements.


For many of us it was in 2015 when Control-Flow Bending: On the Effectiveness of Control-Flow Integrity was presented at USENIX proving printf is turing complete. https://github.com/carlini/printf-tac-toe https://www.usenix.org/conference/usenixsecurity15/technical...




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: