Example
$ cat bitfield.c
struct { int bit:1; } s;
void test()
{
s.bit = 1;
}
$ cc
"bitfield.c", line 1: warning
struct { int bit:1; } s;
^
"bitfield.c", line 5: warning
s.bit = 1;
^
Other notable examples of warnings enabled with the +wlint option:
•Argument is incompatible with formal parameter
•Function declared implicitly
•Function is
•Type conversion may truncate value
•Unsigned value cannot be less than zero
•Missing return statement at end of
•Nested comment is not allowed
•Signed bitfield of length 1
•Memory leak
•Potential null pointer dereference
•Detection of uncaught exceptions
•Uninitialized variables
+w64bit
This option enables warnings that help you detect potential problems in converting
Some of the checks performed are:
•64bit value is implicitly converted to a 32bit value, e.g. long to int.
•Pointer to
Example
$ cat convert.c
int *int_to_ptr (int i)
{
return (int *)i;
}
$ cc
"convert.c", line 3: warning
return (int *)i;
^
3