In C, is it good form to use typedef for a pointer?

前端 未结 8 1784
野性不改
野性不改 2021-01-06 10:46

Consider the following C code:

typedef char * MYCHAR;
MYCHAR x;

My understanding is that the result would be that x is a pointer of type \"

8条回答
  •  不要未来只要你来
    2021-01-06 11:18

    I also think this is a matter of style/convention. In Apple's Core Graphics library they frequently "hide" the pointer and use a convention of appending "Ref" to the end of the type. So for example, CGImage * corresponds to CGImageRef. That way you still know it's a pointer reference.

提交回复
热议问题