【发布时间】:2017-04-02 18:26:11
【问题描述】:
我的问题很简单,是这样吗
typedef struct {a;b;c;d;}bar;
((bar*)ANOTHERSTRUCTPOINTER)->a=1;
((bar*)ANOTHERSTRUCTPOINTER2)->a=1;
//<...>
((bar*)ANOTHERSTRUCTPOINTERn)->a=1;
执行时间和这个一样吗?
((struct {a;b;c;d;}*)ANOTHERSTRUCTPOINTER)->a=1;
((struct {a;b;c;d;}*)ANOTHERSTRUCTPOINTER2)->a=1;
//<...>
((struct {a;b;c;d;}*)ANOTHERSTRUCTPOINTERn)->a=1;
请注意,这只是一个例子,所以不要质疑我没有使用数组的事实
【问题讨论】:
标签: pointers data-structures struct casting typedef