Subject: sanity checking arguments to library functions...
To: None <firstname.lastname@example.org>
From: Luke Mewburn <email@example.com>
Date: 04/13/1999 23:27:02
an idea that came up a while ago was to add stuff to all libc functions
to sanity check arguments (e.g, fgets(char *buf, int n, FILE *fp) having
buf != NULL && fp != NULL, etc)
i think this is a good idea, and unless it breaks standards, we should
do it. of course, people will complain about the performance hit and
the method of highlighting failure, so i suggest that the following
* all of this code would be #ifdef LIBC_DIAGNOSTIC
* have diagnostics one of:
- syslog "function __file__ __line__ ..." (my preferred ;)
* have the failure mode one of:
- return from function a failure code, but continue on
- dump core using abort() (my preferred ;)
obviously, the diagnostics & failure mode has to be decided apon.
maybe that can be conditionally compiled in too based on the setting
if the general idea is that this is ok, i'll start on this in my
infinite spare time.