Missing header files
(BAD_DECL errors)
A common error reported by Insure++ when a header file is missing from a
source file sometimes confuses programmers. For example, compiling the
file foo.c
main()
{
char *ptr = malloc(10);
return 0;
}
with Insure++ results in the following output.
-> insure -g -c foo.c
[foo.c:3] **BAD_DECL**
Declaration of function malloc conflicts with library interface.
Actual return type: malloc_t
Declared return type: int at foo.c, 3
>> char *ptr = malloc(10);
The fix for the bug in foo.c is to add the missing header file,
stdlib.h . Once
this has been done, the file will be processed by Insure++ silently
during compilation because the bug is no longer in the code.
If you are wondering about the "leak" in the above code, see the
article on this situation.
Keywords: include files - #include
For more information .
call (888) 305-0041, fax (626)305-9048, or
email quality@parasoft.com
|