Re: Copyover

From: Daniel A. Koepke (
Date: 11/21/01

On Wed, 21 Nov 2001, Ronald Fenner wrote:

> well as you debug snippet points out so well the file is null, seems
> that in later builds of the c libraries that fclose doesn't check to
> see if the file pointer passed to it is NULL. well it shouldn't.

Calling fclose(0) is always indicative of a programming error and it's
meaningless to attempt runtime recovery of it.  According to the C and C++
standards, fclose(0) is undefined.  While the compiler _could_ check for
NULL and deal with it by returning an error value, this is a bad idea.
Most people don't check fclose() for error return and there are no runtime
cases for which fclose() should be getting called with NULL (if for no
other reason than its behavior is undefined).  The effect of such handling
would be to silently mask a potentially serious design flaw.


   | FAQ: |
   | Archives: |

This archive was generated by hypermail 2b30 : 12/06/01 PST