Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有以下代码。为什么它未定义以下列方式取消引用联合指针?
extern union MyUn *P1; extern union MyUn *P2; extern void myfunc(void) { *P1 = *P2; }
如果你还没有在这个源文件中定义联合,编译器不知道要复制多少。
工会的规模是多少?
这与联合无关,也不是“未定义”:如果您尝试取消引用指向不完整类型的指针(出于显而易见的原因),这只是编译器错误。