Warn if another typedef'd name of a type is used in an argument list

后端 未结 6 1525
天涯浪人
天涯浪人 2021-01-02 09:46

Consider a large project, where many types are typedef\'d, e.g.

typedef int age;
typedef int height;

and some functions gettin

6条回答
  •  春和景丽
    2021-01-02 10:17

    Error will be generated only when types are different. can you wrap these types inside struct and use macros to automate definition and assignment.

    If you are willing to use enum instead of integers then there is an option for warnings on use of mixed enums in static code analysis tool named coverity.

    https://wiki.ubuntu.com/CoverityCheckerDictionary look for MIXED_ENUMS.

提交回复
热议问题