上一页 1 ··· 4 5 6 7 8 9 10 11 下一页
摘要: 小结:常用的gdb命令backtrace 显示程序中的当前位置和表示如何到达当前位置的栈跟踪(同义词:where) breakpoint 在程序中设置一个断点 cd 改变当前工作目录 clear 删除刚才停止处的断点 commands 命中断点时,列出将要执行的命令 continue 从断点开始继续执行 delete 删除一个断点或监测点;也可与其他命令一起使用 display 程序停止时显示变量和表达时 down 下移栈帧,使得另一个函数成为当前函数 frame 选择下一条continue命令的帧 info 显示与该程序有关的各种信息 jump 在源程序中的另一点开始运行 kill 异常终止 阅读全文
posted @ 2014-03-01 14:54 程序员大叔的博客 阅读(196) 评论(0) 推荐(0) 编辑
摘要: JDK7:public final int hashCode() { return Objects.hashCode(getKey()) ^ Objects.hashCode(getValue()); }/** * Retrieve object hash code and applies a supplemental hash function to the * result hash, which defends against poor quality hash functions. This is * critical because HashMap uses power-of-two 阅读全文
posted @ 2014-03-01 14:29 程序员大叔的博客 阅读(1613) 评论(0) 推荐(0) 编辑
摘要: http://blog.csdn.net/feixiaoxing/article/details/6746543 内存越界是我们软件开发中经常遇到的一个问题。不经意间的复制常常导致很严重的后果。经常使用memset、memmove、strcpy、strncpy、strcat、sprintf的朋友肯定对此印象深刻,下面就是我个人在开发中实际遇到的一个开发问题,颇具典型。[cpp] view plaincopy#defineMAX_SET_STR_LENGTH50#defineMAX_GET_STR_LENGTH100int*process(char*pMem,intsize){charlocal 阅读全文
posted @ 2014-03-01 11:09 程序员大叔的博客 阅读(1568) 评论(0) 推荐(0) 编辑
摘要: http://blog.csdn.net/feixiaoxing/article/details/6746335在 我们个人编程的过程当中,内存泄露虽然不会像内存溢出那样造成各种莫名奇妙的问题,但是它的危害也是不可忽视的。一方面,内存的泄露导致我们的软件在运行 过程中占用了越来越多的内存,占有资源而又得不到及时清理,这会导致我们程序的效率越来越低;另一方面,它会影响我们用户的体验,失去市场的竞争能力。 常见的内存泄露是这样的:[cpp] view plaincopyvoidprocess(intsize){char*pData=(char*)malloc(size);/*othercode*/ 阅读全文
posted @ 2014-03-01 11:08 程序员大叔的博客 阅读(391) 评论(0) 推荐(0) 编辑
摘要: http://my.oschina.net/pollybl1255/blog/140323BSS段:(bss segment)通常是指用来存放程序中未初始化的全局变量的一块内存区域。BSS是英文Block Started by Symbol的简称。BSS段属于静态内存分配。 数据段 :数据段(data segment)通常是指用来存放程序中 已初始化 的 全局变量 的一块内存区域。数据段属于静态内存分配。 代码段: 代码段(code segment/text segment)通常是指用来存放 程序执行代码 的一块内存区域。这部分区域的大小在程序运行前就已经确定,并且内存区域通常属于... 阅读全文
posted @ 2014-03-01 10:47 程序员大叔的博客 阅读(612) 评论(0) 推荐(0) 编辑
摘要: 1)判断数据在各位的大小,排列数据;2)根据1的结果,判断数据在十分位的大小,排列数据。如果数据在这个位置的余数相同,那么数据之间的顺序根据上一轮的排列顺序确定;3)依次类推,继续判断数据在百分位、千分位......上面的数据重新排序,直到所有的数据在某一分位上数据都为0。#include #include #include #include int pre_process_data(int array[], int length, int weight){ int index; int value = 1; assert(NULL != array && 0 != lengt 阅读全文
posted @ 2014-02-28 11:28 程序员大叔的博客 阅读(181) 评论(0) 推荐(0) 编辑
摘要: #include #include void swap(int *a, int *b){ int c; c = *a; *a = *b; *b = c;}void set_sorted_value(int array[], int length){ int index = length; if(length 1) { if(array[index >> 1] >= array[index]) break; swap(&(array[index >> 1]), &array[index]); index >>= 1; }}void con 阅读全文
posted @ 2014-02-28 10:11 程序员大叔的博客 阅读(184) 评论(0) 推荐(0) 编辑
摘要: 1)把0~length-1的数组分成左数组和右数组 2)对左数组和右数组进行迭代排序 3)将左数组和右数组进行合并,那么生成的整个数组就是有序的数据数组(关键)#include #include #include #include void merge(int *array, int start, int middle, int end){ int left = start; int right = middle + 1; int length = end - start + 1; int *p = malloc(sizeof(int) * length); assert(NULL != p. 阅读全文
posted @ 2014-02-28 08:58 程序员大叔的博客 阅读(208) 评论(0) 推荐(0) 编辑
摘要: 把数组的第一个数据作为比较的原点,比该数据小的数据排列在左边,比该数据大的数据排列在右边#include #include #include #include void swap(int *a, int *b){ int c; c = *a; *a = *b; *b = c;}void _quick_sort(int array[], int start, int end){ int middle; if(start > end) return; middle = get_middle1(array, start, end); //middle = get_middle2(array, 阅读全文
posted @ 2014-02-28 08:53 程序员大叔的博客 阅读(189) 评论(0) 推荐(0) 编辑
摘要: auto 局部变量(自动储存)break无条件退出程序最内层循环case switch语句中选择项char单字节整型数据const定义不可更改的常量值continue中断本次循环,并转向下一次循环default switch语句中的默认选择项do 用于构成do.....while循环语句double定义双精度浮点型数据else构成if.....else选择程序结构enum枚举extern在其它程序模块中说明了全局变量float定义单精度浮点型数据for构成for循环语句goto构成goto转移结构if构成if....else选择结构int基本整型数据long长整型数据registerCP... 阅读全文
posted @ 2014-02-27 14:21 程序员大叔的博客 阅读(199) 评论(0) 推荐(0) 编辑
上一页 1 ··· 4 5 6 7 8 9 10 11 下一页