What is the right way to typedef a type and the same type's pointer?

后端 未结 6 1219
我寻月下人不归
我寻月下人不归 2020-12-07 03:30

What is the right way to typedef a type and the same type\'s pointer? Here is what I mean. Should I do this:

typedef unsigned int delay;
typedef unsigned int         


        
6条回答
  •  无人及你
    2020-12-07 03:53

    In case of int it shouldn't make any difference, but in case of aggregate types latter approach is better, because in former case *delay isn't equivalent to delayp, and cast would be needed to use them interchangeably.

    But as others mention, you better be off just with delay.

提交回复
热议问题