Subject: Re: segmentation fault on fclose?
To: None <>
From: Charles M. Hannum <>
List: current-users
Date: 09/04/1994 23:42:21
   Just two questions...  Should the following code cause
   a segmentation fault?

   #include <stdio.h>

   FILE *fp;
   fp = NULL;

That's a matter of interpretation.  Note that the man page says:

     #include <stdio.h>

     fclose(FILE *stream)

     The fclose() function dissociates the named stream from its underlying
     file or set of functions.  If the stream was being used for output, any
     buffered data is written first, using fflush(3).

i.e.  `stream' is a description of a stream.  There is no special case
for NULL.  ANSI does not require such a special case, and I really
don't like the idea of masking bugs in applications by kluging up the
C library.