Click on image to see enlargment
Little Sally wrote this program to try to get an idea of how many gifts she would be getting for Christmas, but there is one little flaw that her compiler did not catch. What is it?
bug418.cpp lint Output
--- Module: bug418.cpp _ fopen( filename, "r" ); bug418.cpp 8 Warning 534: Ignoring return value of function 'fopen(const char *, const char *)' (compare with line 51, file c:\ansi\stdio.h) _ while( fgets( buf, BUFLEN, file ) ) bug418.cpp 9 Warning 418: Passing null pointer to function 'fgets(char *, int, FILE *)', arg. no. 3 [Reference: file bug418.cpp: line 4] bug418.cpp 9 Warning 668: Possibly passing a null pointer to function 'fgets(char *, int, FILE *)', arg. no. 3 [Reference: file bug418.cpp: line 4] _ fclose( file ); bug418.cpp 11 Info 802: Conceivably passing a null pointer to function 'fclose(FILE *)', arg. no. 1 [Reference: file bug418.cpp: line 4]
Reference Manual Explanation
418 Passing null pointer to function 'Symbol', Context Reference -- A NULL pointer is being passed to a function identified by Symbol. The argument in question is given by Context. The function is either a library function designed not to receive a NULL pointer or a user function dubbed so via the option -function. See Function Mimicry
If you have comments or questions about this bug, please post them to our Discussion Forum
Previous Bug - Bug #1510 - November 2005