reddit discussion on replacing Python in 0install

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Wed Jun 12 11:36:14 PDT 2013


On 6/12/13 1:36 PM, "Jérôme M. Berger" wrote:
> Denis Koroskin wrote:
>> The best solution would be for writeln() to throw on use, and I
>> think it's fairly easy to implement: just flush once after using
>> the file descriptor for the first time, and throw if it fails.
>>
>> While it doesn't cover a case where file descriptor becomes
>> non-writable during the program lifetime, it covers the most
>> common case of file descriptor not being writable at all.
>
> 	Actually, the best solution is to check if the file is writable
> before writing and *without flushing*. On Posix systems, this can be
> done with:
>
> fcntl (fd, F_GETFL)&  W_OK
>
> 		Jerome

When do you check and how frequently? I think the right thing to do is 
as the bug report indicates.

Andrei


More information about the Digitalmars-d mailing list