This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: newlib: fputs aborts on ARM


2. Thou shalt not follow the NULL pointer, for chaos and madness await
thee at its end.
-- The Ten Commandments for C Programmers
http://www.lysator.liu.se/c/ten-commandments.html

Passing a NULL pointer to a C library function is no different than
dereferncing that same NULL pointer yourself. C library functions do
not check their arguments for a NULL pointer, just as the C language
does not check that an array index is within the bounds of the array.
This work is left up to the programmer so that it is her decision when
and where to do this work.

Consider a putc in an inner loop. The programmer would likely want to
check if the FILE* is NULL only once outside of the loop. If putc
checked itself, this would be done over and over inside the loop
unnecessarily.

This case is just one of those burdens the C programmer has to bear.

Cheers,
Shaun

2005/11/16, Tom Walsh <tom@openhardware.net>:
> Oh, I'm not saying that newlib is not compliant, what my issue is
...


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]