Cppcheck (version 1.46.1) gives the following warning for an enumeration like this:
enum DATABASE_TYPE { DATABASE_TYPE_UNKNOWN = -1,
Backup code: statement found that starts with a numeric constant
I do not think that he is superfluous. It is very important to be able to do such things.
Is this a cppcheck error or am I not seeing anything?
Update
I managed to weld it to a minimal example. This was complicated by cppcheck, having 2 (later) errors, which made it look as if my abbreviations were not affected.
There are 5 files: ah , a.cpp , bh , b.cpp and inc.h with the following contents.
VC9 compiles it without warning (warning level 4).
// ah #pragma once #include "inc.h" // a.cpp #include "ah" #include "bh" int main() { return 0; } // bh #pragma once #include "inc.h" // b.cpp #include "bh" //inc.h #pragma once enum MY_ENUM_TYPE { INVALID_VALUE = -1, FIRST_VALUE, SECOND_VALUE };
So, I'm pretty sure this is a cppcheck error. Any divergent opinions?
foraidt
source share