Hi.

There was no intent to do flush in the middle of the line.

The expected behaviour is to print the line and then show input dialog:
printf();
scanf();

But in safari input dialog is shown before printf is actually finished
(output visible).

fflush() was tried to fix/workaround this in safari.

Anton

2014-11-02 0:01 GMT+06:00 Alecazam <a...@figma.com>:

> I'm not sure what you mean by flushing in the middle of the line.
> fprintf(stderr)  is supposed to be unbuffered (flush after every call), and
> fprintf(stdout) should be buffered.  fflush(stdout) is the typical approach
> to turning stdout to the same behavior as stderr.   A typical printf line
> is the following.
>
> printf("\nSomeText\n\n").   You definitely don't want three flushes from
> that.   I typically avoid direct use of printf in code, and wrap log
> statements around printf.  That way the logs can optionally flush
> (especially on warnings/errors), but buffer the rest of the outputs, and
> provide coloring to specific log types.  You'd be surprised at how log
> statements can bring down performance especially when you are shooting for
> 60 fps.
>
> On Friday, October 31, 2014 11:41:13 AM UTC-7, jj wrote:
>>
>> Can you point to a reference on how the flushing should work then? Note
>> that printing to a web console is line-based, so there is no way to flush
>> without inserting a newline at the same time, which is why flushing is
>> implemented at newline boundaries to preserve correct output. Flushing in
>> the middle of a line would cause incorrect printing, and I don't think
>> there is a performance benefit in flushing more seldomly either - that
>> would just lead to more potential confusion.
>>
>>  --
> You received this message because you are subscribed to a topic in the
> Google Groups "emscripten-discuss" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/emscripten-discuss/5EN4FxJwYUU/unsubscribe
> .
> To unsubscribe from this group and all its topics, send an email to
> emscripten-discuss+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"emscripten-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to emscripten-discuss+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to