Subject: Re: Is fclose(NULL) defined?
To: None <lukem@telstra.com.au>
From: Callum Gibson <callum@frost.bain.oz.au>
List: current-users
Date: 09/13/1995 11:20:51
Luke Mewburn writes:
:-)> The implementors of those versions of fclose() might have confused
:-)> it with fflush(). Fflush() *can* be called with a NULL argument
:-)> (meaning to fflush() all output files). Not that it matters, since
:-)> fclose(NULL) is undefined behaviour, which means anything can
:-)> happen, including not crashing.
:-)Yes, but IMHO libc should error-check stuff, even simple null pointer
:-)checks would save a lot of hassles.
If it's going to error-check stuff like that it should do it with asserts.
To silently allow bad code like fclose(NULL) is simply encouraging bad
programming.
regards,
Callum
Callum Gibson callum@bain.oz.au
Fixed Income Division, DB Bain & Co. 61 2 258 1620
## The opinions presented herein do not represent those of DB Bain & Co ###