Subject: Re: Is fclose(NULL) defined?
To: None <current-users@NetBSD.ORG>
From: Mike Long <mike.long@analog.com>
List: current-users
Date: 09/13/1995 11:52:25
callum@frost.bain.oz.au (Callum Gibson) writes:
>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.
Have you looked at the code for fclose()? The first thing it does is
dereference its argument. If the argument is NULL, then the result is
a SEGV and a core dump. That's not very silent. :-)
--
Mike Long <mike.long@analog.com> http://www.shore.net/~mikel
VLSI Design Engineer finger mikel@shore.net for PGP public key
Analog Devices, CPD Division CCBF225E7D3F7ECB2C8F7ABB15D9BE7B
Norwood, MA 02062 USA assert(*this!=opinionof(Analog));