On 6/13/2013 6:24 AM, Steven Schveighoffer wrote:
If this was such a big deal, then FILE * would guarantee the alignment went
back.  It's not that hard.

I know it isn't hard. But D's charter is not to go and patch the C runtime library, nor is that remotely practical across all the thousands of C implementations out there.


And I have experience with turning them off -- some of my clients requested that
to avoid losing data that was in the write cache.  It does not all of a sudden
slow down the performance of the drive.

I ran some experiments a while back writing to a slow SD card. There was a big difference in speed when turning write caching on and off. I bet you'll see quite a whopper of a difference if you try that with a floppy drive!

In other words, the difference shows up when you've got a fairly slow device. Write caching would not have been invented if it had no effect.


But this whole discussion is academic at this point, Jérôme identified that we
can simply check to see if the file descriptor is valid, without flushing.

His fix is insufficient for other reasons as already pointed out.


This isn't the problem that was presented.  The problem that was presented is
that given an invalid file descriptor, writeln happily works (as long as you
don't cause a flush) and does not throw.  This is unintuitive to someone who is
expecting writeln to choke on an invalid descriptor.

That behavior is normal to anyone used to working with C stdio.

What is wrong and needs fixing is the program exiting with "success" indication when the output has actually failed.

Reply via email to