Menu

#38 typedef'd type inconsistently checked

open
nobody
None
5
2007-06-12
2007-06-12
Anonymous
No

splint correctly warns when a variable of a typedef-ed type is assigned a value of a different type. But no warning is given when the variable is initialized:

--------------- example -----------------
typedef unsigned char mychar;

void f( void )
{
mychar a = 'a';

a = 'b';

}

---------------- splint output ---------------
Splint 3.1.1.2 --- 27 May 2007

su.c: (in function f)
su.c:8:3: Assignment of char to mychar: a = 'b'
Types are incompatible. (Use -type to inhibit warning)

Finished checking --- 1 code warning

Discussion


Log in to post a comment.

MongoDB Logo MongoDB