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

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Jun 12 12:09:07 PDT 2013


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


Steven Schveighoffer <schveiguy at yahoo.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |schveiguy at yahoo.com


--- Comment #1 from Steven Schveighoffer <schveiguy at yahoo.com> 2013-06-12 12:09:06 PDT ---
On one hand, I disagree that stdout failing to flush on program exit should
trump whatever main returns.  The application simply may not care.

On the other hand, if stdout is invalid, and any output is done, writeln could
fail itself at any time.  If this is not expected, the effect is the same.

This can be opt-out also:

int main()
{
   ....
   try { fflush(NULL); } catch {}
   return 0;
}

So I'm OK with this.

I still think it's worth checking on first write whether the file descriptor is
valid (this only needs to be done for File instances opened with an existing
FILE * or file descriptor).  The advantage here is that the error occurs at
first use, not at some time later (possibly at program end!).  If the user is
simply using an invalid file descriptor, I'd rather see the exception at use,
not on program exit.

-- 
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