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

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

    No, there cannot be. A compiler will warn you if you're doing (or about to do) something illegal. It is not supposed to know (or determine the correctness of) the values which you will be passing as function parameter. As long as the types are same, it does not have any reason to complain.

    However, in case of type mismatch, it will alert you.

提交回复
热议问题