摘要: C++struct支持数据类型为简单类型的隐式转换,包括stl中一些容器。 #include <iostream> #include <string> struct Widget { int x; std::string str; }; int main() { Widget w1; w1.x = 阅读全文
posted @ 2020-11-25 19:52 cyssmile 阅读(101) 评论(0) 推荐(0) 编辑
摘要: 最近写代码,内存分配不管二级还是一级全放在一起申请,导致各种地址偏移,转换。这里记录几个常见的数据的大小 #include <iostream> #include <stdint.h> int main() { std::cout << "void** :" << sizeof(void**) << 阅读全文
posted @ 2020-11-25 15:28 cyssmile 阅读(669) 评论(0) 推荐(0) 编辑
摘要: error: deleting ‘void*’ is undefined [-Werror=delete-incomplete] 今天做了一件这样的事 params_size = 2 * sizeof(void *) + sizeof(int *) + 2 * sizeof(int) + sizeo 阅读全文
posted @ 2020-11-25 14:37 cyssmile 阅读(595) 评论(0) 推荐(0) 编辑