3 ms·
I've always found it interesting that the list of safe functions includes read(), write(), and most of the filesystem operations; so while printf is not safe, y
by userbinator 12y ago
I've always found it interesting that the list of safe functions includes read(), write(), and most of the filesystem operations; so while printf is not safe, you could use write() if you really wanted to output.
- gryph0n 12y agowrite() is an OS system call, while printf() is a C function call. C libraries can (and do) choose to buffer printf, while read/write are usually unbuffered. Of course, both are mechanisms are modifying some global state (your terminal's state), and cannot be relied to be free of race-conditions.