In this section:
Insure++ checks that each function returns a result consistent with its declared data type, and that a function with a declared return type actually returns an appropriate value.
In order for Insure++ to find this error, the |
|
The following code demonstrates an inconsistent return error:
/*
* File: retinc.c
*/
func() {
return;
} |
[retinc.c:4] **RETURN_INCONSISTENT**
Function has an inconsistent return type.
>> func() {
---- Associated Common Weakness Enumerations ----
CWE-758: Reliance on undefined, unspecified, or implementation-defined behavior |
Correct inconsistent return errors by either adding appropriate declarations or by making the return type consistent with the function declaration.
/*
* File: retinc.c
*/
void func() {
return;
} |
/*
* File: retinc.c
*/
int func() {
return 0;
} |
The table below shows Common Weakness Enumerations associated with this error.
| CWE | Description |
|---|---|
| CWE-758 | Reliance on undefined, unspecified, or implementation-defined behavior |