Insure++ Reference - EXPR_UNINIT_PTR
This error is generated whenever an expression operates on an
uninitialized pointer.
The following code uses an uninitialized pointer.
1: /*
2: * File: expuptr.c
3: */
4: main()
5: {
6: char *a, b[10], c[10];
7:
8: if(a > b)
9: a = b;
9: return (0);
10: }
1. [expuptr.c:8] **EXPR_UNINIT_PTR**
>> if (a > b)
2. Expression uses uninitialized pointer: a > b
3. Stack trace where the error occurred:
main() expuptr.c, 8
- Source line at which the problem was detected.
- Description of the problem and the expression that is in error.
- Stack trace showing the function call sequence leading to the
error.
This error is normally caused by omitting an assignment statement for
the uninitialized variable. The example code can be corrected as follows:
1: /*
2: * File: expuptr.c (modified)
3: */
4: main()
5: {
6: char *a, b[10], c[10];
7:
8: a = c;
9: if(a > b)
10: a = b;
11: return (0);
12: }
EXPR_NULL
EXPR_UNRELATED_PTRCMP
|