上一页 1 2 3 4 5 6 7 8 9 ··· 18 下一页
摘要: #pragma pack(6)struct test{ char f[10]; //自身对齐值是1,指定对齐值是6,有效对齐值1 //f首地址0x0, 所在内存空间0x0-0x09 double z; //自身对齐值是8,指定对齐值是6,有效对齐值6 //z的首地址需要被有效值6整除,但是0x09之 阅读全文
posted @ 2021-03-01 19:07 唯一诺 阅读(459) 评论(0) 推荐(0)
摘要: int main(){ int arr[] = { 1, 2, 3, 4, 6, 7,6 }; int hashTable[10000] = { 0, }; int start = 0; int max = 1; int size = sizeof(arr); for (int i = 0; i < 阅读全文
posted @ 2021-03-01 16:48 唯一诺 阅读(98) 评论(0) 推荐(0)
摘要: 1. 启动init进程2. 读取inittab配置表 myttyS0: :respawn : /etc/init.d/appauto label : runlevel :action : process respawn: 如果process字段指定的进程不存在,则启动该进程,init不等待处理结束, 阅读全文
posted @ 2021-03-01 16:47 唯一诺 阅读(709) 评论(0) 推荐(0)
摘要: movies = ["A", "B", "C"] print(movies[2]) print("%d" %len(movies)) movies.append("nihao") print(movies) movies.pop() print(movies) movies.extend(["www 阅读全文
posted @ 2021-01-18 20:07 唯一诺 阅读(79) 评论(0) 推荐(0)
摘要: 转载:http://c.biancheng.net/view/422.html 程序运行时常会碰到一些异常情况,例如: 做除法的时候除数为 0; 用户输入年龄时输入了一个负数; 用 new 运算符动态分配空间时,空间不够导致无法分配; 访问数组元素时,下标越界;打开文件读取时,文件不存在。 这些异常 阅读全文
posted @ 2020-11-12 19:34 唯一诺 阅读(273) 评论(0) 推荐(0)
摘要: 1.对于单纯常数量,最好使用const对象或者enum替换#defines 2.对于长的像函数的宏定义,最好改用inline内联函数替换#define 阅读全文
posted @ 2020-10-29 20:02 唯一诺 阅读(90) 评论(0) 推荐(0)
摘要: 1.如果类A可能会被继承,那么A的析构函数一定要被设置为virtual虚函数; 原因:如果基类的析构函数不是虚函数,当创建一个基类指针指向一个派生类对象,当释放此基类指针时,子类的析构函数不会被调用; 如下: class CFather { public: CFather(); virtual ~C 阅读全文
posted @ 2020-10-21 09:04 唯一诺 阅读(752) 评论(0) 推荐(0)
摘要: class CFather { public: CFather(); virtual ~CFather(); public: virtual void test(); //virtual void getHouse() = 0; public: int b; const static int c = 阅读全文
posted @ 2020-10-21 08:50 唯一诺 阅读(139) 评论(0) 推荐(0)
摘要: class B{public: explicit B(int x= 0,bool b = true);}void doSomething(B obj) B obj; doSomething(obj) //没有问题 doSomething(28) //有问题,doSomething入参应该是B类类型, 阅读全文
posted @ 2020-10-19 14:42 唯一诺 阅读(111) 评论(0) 推荐(0)
摘要: 1.Linux环境下可通过inet_pton()函数判断,返回值为1,表示IP正常,否则异常 2.windows环境下可通过WSAStringToAddress()函数判断,返回值为0,表示IP正常,否则异常 阅读全文
posted @ 2020-10-19 14:04 唯一诺 阅读(335) 评论(0) 推荐(0)
上一页 1 2 3 4 5 6 7 8 9 ··· 18 下一页