The following code seems to compile fine.
typedef struct Test {
int i;
int j;
} Test;
int main() {
int i;
i = 0;
Test p = {i, 1};
printf("%d\n", p.i);
return 0;
}
Splint fails with
example2.c:9:7: Parse Error. (For help on parse errors, see splint -help
parseerrors.
(This is the line Test p = {i, 1};
)
Is this illegal C, or is this a bug in splint?
(I want to do this because I want p to be const
, although the failure seems to happen even when I remove the const
modifier. If I move the declaration and initialization of i
onto one line, the problem also seems to go away.)