seekdir dereferences null

duane ellis duane-newlib@duaneellis.com
Fri Dec 5 13:51:00 GMT 2008


[varous]> [ NULL check in system libraries ]

[ericblake]>  Where do the standards mandate that this [TEST] is 
required to be supported? 

jeff> If anybody has evidence to the contrary, feel free to comment.

Not to the contrary ... but a different view.

Eric makes a good point.  It is no different then fprintf( NULL, "foo );
Bloat sucks. And there are *BIGGER* bloat monsters.

Part of me wants this though... Perhaps - NULL check *COULD* be in a 
#ifdef DEBUG build ....

or maybe something like:

    #if    defined( DEBUG ) || defined( PARMCHECKING_ENABLED)
    #define    __parmcheck_NOT_NULL(  PTR )   ...
    #endif

I've seen this in other libraries - it is a nice feature one can 
*enable* if they need it.

-----------

Speaking of *BLOAT* - a *NASTY* piece of bloat occurs if:

If REENT_SMALL is enabled, look at the #define CHECK_INIT in  stdio/local.h.
it is repeated in *NUMEROUS* files - over and over again +40 times!

That macro is the definition of *B*L*O*A*T*.
Macros are ok - if they are short & sweet, and call a *TRUE* function 
like this:

    #define    CHECK_INIT(PTR,FP)  \ 
                  __newlib_check_init( ptr, fp )

And that is what check init *SHOULD* be!

-Duane.




More information about the Newlib mailing list