05 2011 档案

摘要:配置文件读取程序 conf.h#ifndef CONF_H_INCLUDE__#define CONF_H_INCLUDE__#include <string>#include <map>#include <sstream>#include <stdio.h>#include <stdlib.h>#include <string.h>#define CONF_BLANK_SEP "\t\v\r\n "class Conf { public: static std::string right_trim(s 阅读全文
posted @ 2011-05-16 18:30 napoleon_liu 阅读(714) 评论(0) 推荐(0)
摘要:#ifndef FILE_LOCK_H_INCLUDE_#define FILE_LOCK_H_INCLUDE_#include <sys/types.h>#include <sys/stat.h>#include <fcntl.h>#include <unistd.h>class FileLock { public: explicit FileLock(int file_des) { m_file_des = file_des; } FileLock() { m_file_des = -1; } void attach(int fd) { m_ 阅读全文
posted @ 2011-05-13 18:34 napoleon_liu 阅读(562) 评论(2) 推荐(0)
摘要:vim 写程序没有tags很麻烦, 如果你在一个新项目下,那更是麻烦。本脚本, 利用 gcc 的 -MMD选项生成文件依赖, 这样可以利用工程的makefile来生成 cscope和tags。 真是太强了。gen_cscope_tag.sh 内容如下:#!/bin/bashtarget="$*"is_gen_all=1;CSCOPE_DIR=.cscopeTAGS_DIR=.tagsCFLAGS+=-MMD make $targetexport CFLAGSfunction get_dep_files(){ sed -r -e 's/\s+/\n/g' | 阅读全文
posted @ 2011-05-06 19:36 napoleon_liu 阅读(2100) 评论(0) 推荐(1)
摘要:by falcon<zhangjinw@gmail.com> 2008-02-22 平时在Linux下写代码,直接用"gcc -o out in.c"就把代码编译好了,但是这后面到底做了什么事情呢?如果学习过编译原理则不难理解,一般高级语言程序编译的过程莫过于:预处理、编译、汇编、链 接。gcc在后台实际上也经历了这几个过程,我们可以通过-v参数查看它的编译细节,如果想看某个具体的编译过程,则可... 阅读全文
posted @ 2011-05-06 11:33 napoleon_liu 阅读(6930) 评论(3) 推荐(0)