目 录 第一章 技巧规则······································································································ (2) 第 二章 函数模板······································································································ (4) 第三章 功能模板····································································································· (11) 第四章 udop················································································································ (24) 注:连接:Ctrl+单击鼠标左键 第一章 技巧规则 1,内存原则: 【规则1】用malloc或new申请内存之后,应该立即检查指针值是否为NULL。 防止使用指针值为NULL的内存。 【规则2】不要忘记为数组和动态内存赋初值。防止将未被初始化的内存作为右 值使用。 【规则3】避免数组或指针的下标越界,特别要当心发生“多1”或者“少1” 操作。 【规则4】动态内存的申请与释放必须配对,防止内存泄漏。 【规则5】用free或delete释放了内存之后,立即将指针设置为NULL,防止产 生“野指针”。 2, 数组要么在静态存储区被创建(如全局数组),要么在栈上被创建。数组名对应着(而不是指向)一块内存,其地址与容量在生命期内保持不变,只有数组的内容可以改变。 指针可以随时指向任意类型的内存块,它的特征是“可变”,所以我们常用指针来操作动态内存。指针远比数组灵活,但也更危险。 注意当数组作为函数的参数进行传递时,该数组自动退化为同类型的指针。 new/delete的功能完全覆盖了malloc/free,为什么C++不把malloc/free淘 汰出局呢? 这是因为C++程序经常要调用C函数,而C程序只能用malloc/free管理动态内存。 2,分配空间 double (*point)[3]; point = new double[count][3]; delete[]point;//正确的用法 /*delete point;//错误的用法=delete point[0]*/ 3, UF_MODL_update();//使用UF_MODL_edit时用来刷新 4 UF_UI_ONT_refresh ();//刷新导航器 头文件#include <uf_ui_ont.h> UF_DISP_refresh();//去除临时文件 #include < uf_disp.h>
4 w8 h! ~9 f# A& r& o+ X5 调试工具 1)uc1601 //显示消息对话框 |