Subject: Re: sanity checking arguments to library functions...
To: None <firstname.lastname@example.org>
From: Guenther Grau <Guenther.Grau@bk.bosch.de>
Date: 04/13/1999 16:22:38
Luke Mewburn wrote:
> 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
I don't think it breaks any standards. The standards usually just say:
Behaviour will be undefined, if a null pointer is passed. "Undefined"
maens we can do anything :-) AFAIK, there are a few rare cases where
passing a null pointer is allowed (fclose?, don't have the man pages
handy), which would have to be allowed, of course.
> do it. of course, people will complain about the performance hit and
me, too :-)
> the method of highlighting failure, so i suggest that the following
> - syslog "function __file__ __line__ ..." (my preferred ;)
> * have the failure mode one of:
> - dump core using abort() (my preferred ;)
Sounds like I could work very well together with you as we seem
to share the same preferences :-)
If it isn't clear, I am a 100% for it :-)