有什么区别:
typedef struct
{
int a;
int b;
} S1, *S1PTR;
((S1PTR)structure)->b)
和
typedef struct
{
int a;
int b;
} S1;
((S1*)structure)->b)
最佳答案
What is the difference between these typedef uses?
编译器没有区别。
这是一种风格差异。
(S1*)structure
看起来像是对指针的强制转换 - 确实如此。
(S1PTR)structure
看起来不像是对指针的转换 - 但它确实是对指针的转换。
*
比 ...PTR
更响亮。
此外:使用仅大写的标识符提示 #define
,但事实并非如此。
按照您所在小组的编码准则进行编码。我使用的不会在这里宽恕 S1PTR
。
关于c - 这些 typedef 用法有什么区别?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54192622/