In certain languages (i.e. C), writes to streams like
stdout can be buffered by default - what this means is that when one calls functions like
printf() to produce output, it is not necessarily written to the console immediately. Instead, it is (by default) printed when a linefeed is written, the buffer is filled, the stream is closed or the buffer is explicitly flushed (i.e.
This becomes important in certain challenges, like this one, which require a delay between outputs and where the length of the source code matters.
Consider the two ways to achieve this:
You flush the buffer after every write with a call, i.e.
or you turn off buffering for
However, these do not come for free - especially in code-golf the 14+ extra bytes can really hurt solutions. In fact, in the challenge linked above, none of the answers in C account for
stdout being buffered.
Is it acceptable to assume that streams are non-buffering, even when by default they are not? Or, in other words, do solutions need to account for output potentially being buffered?