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

后端 未结 6 1530
天涯浪人
天涯浪人 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:36

    As has been made clear by the other responses, you're not going to get this for free from gcc. You are definitely into the world of static analysis tools to solve this.

    There have been several suggestions for this, some of which require extra annotation, some of which don't but may be more than you're looking for. I therefore thought I'd throw one more into the mix...

    A long stand by for me has been the various command line lint tools. In your case, I think PC-lint/flexelint fits very well even though it is a commercial tool. See here for its strong type checking.

提交回复
热议问题