A Brainfuck interpreter inside a single printf statement
github.com
github.com
http://pubs.opengroup.org/onlinepubs/009695399/functions/fpr...
"The argument shall be a pointer to an integer into which is written the number of bytes written to the output so far by this call to one of the fprintf() functions. No argument is converted."
The * parameter provides the "input", since it allows controlling the number of bytes written with its parameter, which is then written to the n parameter.
[ == if (*dataptr == 0) goto ]
Isn't this wrong? I mean, `[` starts a loop, it doesn't mean goto `]`. Unless I'm getting the semantics wrong, at least one iteration should execute, even if the current cell is set at zero.Is this possible without invoking undefined behavior? FWIW the demos just crash with SIGILL on macOS.
/me adds this to his embedded vsnprintf regression testsuite
Edit : why the downvotes? This is a real question, I'm didn't get why they were used for here.
printf("Time elapsed...
on line 236 of the C code. I presume that isn't it. Any ideas?