|
PC-lint/FlexeLint Output | Reference Manual Explanation | Home Page bug678.cpp
The programmer is creating a structure to describe an automobile. What fatal mistake is he or she making?
bug678.cpp lint Output
--- Module: bug678.cpp
_
enum color_t color:2;
bug678.cpp 12 Warning 678: Member 'car::color' field length (2) too small
for enum precision (3)
Reference Manual Explanation
678 Member 'Symbol' field length (Integer) too small for enum precision
(Integer) -- A bit field was found to be too small to support all the
values of an enumeration (that was used as the base of the bit field).
For example:
enum color { red, green, yellow, blue };
struct abc { enum color c:2; };
Here, the message is not given because the four enumeration values of
color will just fit within 2 bits. However, if one additional color
is inserted, Warning 678 will be issued informing the programmer of
the undesirable and dangerous condition.
|
Previous Bug - Bug #433 - November 2001