[Issue 10344] Exiting _Dmain should flush all FILE*s and return nonzero on failure

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Jun 17 13:34:56 PDT 2013


http://d.puremagic.com/issues/show_bug.cgi?id=10344



--- Comment #15 from Andrei Alexandrescu <andrei at erdani.com> 2013-06-17 13:34:56 PDT ---
(In reply to comment #13)
> Proposed compromise:
> 
> In addition to the proposed change that throws on the final flush and adjusts
> the error code, provide a writable flag in File that indicates an i/o error
> should not throw.  Then if stdout output errors are deemed not critical, the
> final flush will not throw or adjust the error code.  In addition, any failure
> during execution when fflush is called will not throw.
> 
> This might actually be a better solution to the use case I have provided,
> because the intent is clearly stated from the developer up front, that stdout's
> failures are not critical to the program.

Sounds good, but this is the approach taken by C++'s iostreams:
http://msdn.microsoft.com/en-us/library/xybta3wf(v=vs.80).aspx. It hasn't
enjoyed a lot of success.

Then we'll need to define ways for people to access error codes etc. which
means writeln and friends would need to return them, or provide lastError()
APIs etc. It would necessitate some design.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list