jacob navia写道:jacob navia wrote: 3)公开问题是如何处理的: A)工会。在我看来,没有办法知道工会的哪些成员是有效的,所以工会不会被跟踪而只是以二进制形式存储。 B)函数指针。没有简单的方法可以知道什么是存储在函数指针中的函数的名称。如果程序在同一地址加载,存储指针可能很有用。 />你会对工会和函数指针提出什么建议? jacob 3) Open issues are what to do with: A) Unions. In my opinion there is no way to know which of the members of the union is valid, so unions will not be followed and just stored in binary form. B) Function pointers. There is no easy way to know what is the name of the function stored in a function pointer. Storing the pointer may be useful if the program is loaded at the same address. What would you propose for unions and function pointers? jacob 你可以提供序列化函数来获取union 类型和/或已分配的特定 结构的函数指针,按结构中的外观顺序排列。你可以轻松地通过重载函数来实现这一点,使用你的C编译器和 重载扩展; - > 这个是我会这样做的方式。可能你已经想过了更好的解决方案。 BahadirYou could provide serialisation functions that take a list of uniontypes and/or already assigned function pointers for that particularstructure, in order of appeareance in the structure. You could easilydo this by overloading the function, using your C compiler withoverloading extensions ;->This is the way I would have done it. Probably you have already thoughtof better solutions.Bahadir 这篇关于C中的对象持久性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云! 08-11 05:10