[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: gcc and mint-libs PL46



Chris Ridd <chris@imc.exec.nhs.uk> writes:

|>>> fopen( NULL, "r" );
|>>> 
|>>> Results in a Bus Error.
|>> 
|>> Dereferencing a NULL pointer is not portable, so it's not a library bug.
|>> You'll get the same result on many UNIX systems.

|> But it could be argued the fopen library code should check for a NULL
|> filename and return a NULL pointer.

No, the library should not correct the users bugs.  If you added
checks for NULL and other illegal input to all the lib functions it
will be slow like a snail.  Add the checks to your program where it
matters, most times it won't.

Andreas.