上一页 1 ··· 7 8 9 10 11 12 下一页
摘要: /linux/include/linux/kernel.h中有min(x, y)和max(x, y)的定义如下: 1 #define min(x, y) ({ \ 2 typeof(x) _min1 = x; \ 3 typeof(y) _min2 = y; \ 4 (void) (&_min1 == &_min2); \ 5 _min1 _max2 ? _max1 : _max2; }红色两行的作用为:防止不同类型的参数进行比较;当参数类型不同时,编译器会提示:warning: comparison of distinct pointer... 阅读全文
posted @ 2013-09-08 12:47 tanghuimin0713 阅读(1922) 评论(2) 推荐(1) 编辑
摘要: 1 #include 2 3 #define swap_macro_0(a, b) \ 4 do { \ 5 typeof(a) c; \ 6 c = a; \ 7 a = b; \ 8 b = c; \ 9 } while(0)10 11 #define swap_macro_1(a, b) \12 do { \13 a = a + b; \14 b = a - b; \15 a = a - b;... 阅读全文
posted @ 2013-07-28 09:00 tanghuimin0713 阅读(634) 评论(8) 推荐(1) 编辑
摘要: 参考文章:《Inside MoPaQ》chapter two适用场合:存在一个庞大的字符串数组,给定一个字符串,判断其是否在字符串数组中;主要思想:1、分配一段大小为(MAXMPQHASHTABLELEN * sizeof(MPQHASHTABLE))的堆空间作为哈希表;MPQHASHTABLE定义如下:typedef struct { long nHashA; long nHashB; unsigned int bExists;}MPQHASHTABLE;2、将字符串存入哈希表时,为每个字符串计算三个哈希值,nHash, nHashA, nHashB, nHash用于确定字... 阅读全文
posted @ 2013-06-20 20:46 tanghuimin0713 阅读(2241) 评论(2) 推荐(0) 编辑
摘要: 1.设置环境变量MALLOC_TRACE,指定程序生成的日志文件存放路径export MALLOC_TRACE=/var/ftp/xx.log2.修改代码包含头文件:#include <mcheck.h>main函数调用:mtrace();3.编译运行gcc -g -o xx xx.c./xx4.用mtrace(一个perl脚本)解析日志文件./mtrace xx xx.log5.内存泄露信息如下所示附件:mtrace工具 阅读全文
posted @ 2013-06-15 12:29 tanghuimin0713 阅读(490) 评论(0) 推荐(0) 编辑
摘要: 1.安装ctags1) ./configure2) make3) make install2.安装taglistunzip taglist_xx.zip #当前目录下会生成doc和plugin两个文件夹cp doc/taglist.txt /usr/share/vim/vim72/doc/. #taglist.txt: taglist帮助文件cp plugin/taglist.vim /usr/share/vim/vim72/plugin/. #taglist.vim: taglist配置文件打开vim:helptags /usr/share/vim/vim72/doc/ #添加帮助文件... 阅读全文
posted @ 2013-05-13 21:46 tanghuimin0713 阅读(371) 评论(0) 推荐(0) 编辑
摘要: 1.wget下载linux kernel源码:wget https://www.kernel.org/pub/linux/kernel/v3.x/linux-3.9.2.tar.xz2.wget下载gcc 源码:wget http://ftp.gnu.org/gnu/gcc/gcc-4.8.0/gcc-4.8.0.tar.gz3.wget下载gdb源码:wget http://ftp.gnu.org/gnu/gdb/gdb-7.6.tar.gz4.wget下载glibc源码:wget http://ftp.gnu.org/gnu/glibc/glibc-2.17.tar.gz另:.tar.xz 阅读全文
posted @ 2013-05-12 15:54 tanghuimin0713 阅读(368) 评论(0) 推荐(0) 编辑
摘要: yum -y install gcc 阅读全文
posted @ 2013-04-30 16:16 tanghuimin0713 阅读(151) 评论(0) 推荐(0) 编辑
摘要: ntpdate 0.pool.ntp.org注:0.pool.ntp.org = 世界标准时间中心 阅读全文
posted @ 2013-04-25 07:16 tanghuimin0713 阅读(195) 评论(0) 推荐(0) 编辑
摘要: 系统开机默认会进入图形界面,要切换到命令行模式还得手动Alt + F2,F3......,很麻烦。vim /etc/inittab默认内容为:id:5:initdefault:改为:id:3:initdefault:5:X11,即图形界面3:Full multiuser mode,即多用户模式的命令行界面关于运行级别0~6,/etc/inittab文件中自有解释。关机命令:init 0 或者 halt重启命令:init 6 或者 reboot 阅读全文
posted @ 2013-04-24 21:39 tanghuimin0713 阅读(3956) 评论(0) 推荐(0) 编辑
摘要: 想彻底和图形界面say goodbye,干脆连开机画面也不要了吧。黑屏刷出一大片开机信息给人一种酷酷的感觉,虽然现在还不明白那些信息是啥意思(*^__^*) 。 vim /boot/grub/grub.conf 删除“rhgb quiet”。 ok,重启的话就看到想要的效果了。 解释: rhgb:用图片来代替启动过程中的文本信息,这些文本信息在启动完成后可以用dmesg查看。 rhgb=redhatgraphicalboot-ThisisaGUImodebootingscreenwith mostoftheinformationhiddenwhiletheuserseesarot... 阅读全文
posted @ 2013-04-24 21:27 tanghuimin0713 阅读(570) 评论(0) 推荐(0) 编辑
上一页 1 ··· 7 8 9 10 11 12 下一页