Live data from Hacker News

C implementation of Tic-Tac-Toe in a single call to printf

github.com

81–85 of 85 posts

Re: C implementation of Tic-Tac-Toe in a single call to printf

#81
Holy Crap Batman!

Never in a million years would I have thought that printf() was Turing-Complete -- and yet, here's the proof that it is...

And then there's this related paper:

https://www.usenix.org/system/files/conference/usenixsecurit...

Page 175: "Printf is Turing-complete"

Re: C implementation of Tic-Tac-Toe in a single call to printf

#83

Earlier quoted context omitted.

Would you say that an infinite loop has infinite lines of code?

It has infinite instructions, yes. (Well, "unbounded" or "endless", if we're being picky.)

No it doesn’t. It has finite instructions for the loop body, and then one jump instruction for the loop.

Re: C implementation of Tic-Tac-Toe in a single call to printf

#84
post #51

Earlier quoted context omitted.

This only works if you're not dealing with Unicode, where the number of bytes, the number of characters, and the width of those characters can all vary.

This makes me wonder if there's some sort of Unicode equivalent for this?

wcwidth()

Re: C implementation of Tic-Tac-Toe in a single call to printf

#85
post #84
post #51

Earlier quoted context omitted.

This makes me wonder if there's some sort of Unicode equivalent for this?

wcwidth()

Thanks, I wasn't aware of this. Here's a man page for anyone else that was interested: https://man7.org/linux/man-pages/man3/wcwidth.3.html
Post reply on HN