On 12/23/19 11:02 AM, Adam D. Ruppe wrote:
On Monday, 23 December 2019 at 15:41:33 UTC, Steven Schveighoffer wrote:
That means we have to buffer separately, which means we have a problem
interleaving printf with writef. It would be awful.
Or simply don't buffer. Any call you get, flush the C buffer and write
the D stuff immediately.
Unbuffered output would perform badly, especially if you are writing
characters at a time (which is what formattedWrite does). But I think
this would solve the interleaving problem.
Remember, this code branch is only called if we already know it is an
interactive console. They're usually flushed frequently (at least at
every line) anyway... so especially with writeln / writefln those are
virtually guaranteed and certainly expected to flush at the end anyway.
I really don't think any performance concern would be significant.
Honestly, I think it sounds horrible to have yet another special case
for this specific situation. But also, I almost never use Windows for D
work, so I'm fine if you want to duct tape some more cruft onto that
branch. std.stdio is already a pretty big mess.
-Steve