Subject: Re: Is fclose(NULL) defined?
To: None <current-users@NetBSD.ORG>
From: Mike Long <mike.long@analog.com>
List: current-users
Date: 09/12/1995 23:55:47
[some attributions lost in the mists of time]
>> Yes, but IMHO libc should error-check stuff, even simple null pointer
>> checks would save a lot of hassles.
>
>There appear to be two schools of thought on these issues--they made
>themselves known in the gets() debates...
>
>View 1: libc should allow old code to compile and run without nuisances
>        like printf()'s showing up when you run the program.  There is
>        too much old code that people are trying to run on NetBSD and
>        the people doing the "ports" don't necessarily understand the
>        code or even (possibly) the C language and can't be expected
>        to fix, say, trn on their own.
>
>View 2: libc should "encourage" people to write good code by complaining
>        whenever it notices incorrect or deprecated behavior/use.
>        Flagging errors as soon as possible makes the program more
>        portable in the long run.

I'd like to add:

View 3: try to limit bloat in libc wherever possible.

Remember that we still want to be able to install NetBSD off of a
single 5.25" 1.2M floppy drive. :-)

I would prefer that libc (and other libs) use the same system as the
kernel:  Wrap all non-required error-checking code with
#ifdef DIAGNOSTIC/#endif.  The abort() function replaces panic().
Then it's either your choice whether diagnostic code is included, or
you can build a separate libc_g.a for debugging with -g and
DIAGNOSTIC.
-- 
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));