原创 linux shell中,unlink和rm命令有什麼區別

strace 跑 rm 與 unlink,結果有不同地方. 1. strace rm 1.txt 片段access("1.txt", W_OK)  

原创 關於C數據類型長度

#include <string.h> #include <stdio.h> int main() { printf("%d\n", sizeof(int)); printf("%d\n", sizeof(long)); pr

原创 gdb 線程鎖與non-stop模式

1.前提   gdb -v 查看版本信息   7.0以前不支持non-stop模式 2.線程鎖 set scheduler-locking on/o

原创 關於CppUnit裏面宏的介紹

本文是討論開放源碼單元測試工具的 系列文章 的第 2 篇,介紹非常受歡迎的 CppUnit — 最初由 Eric Gamma 和 Kent Beck 開發的 JUnit 測試框架的 C++ 版本。C++ 版本由 Michael Fea

原创 Linux程序編譯速度提高方法

1. 使用tmpfs來代替部分IO讀寫   2. ccache,可以將ccache的緩存文件設置在tmpfs上,但是這樣的話,每次開機後,ccach

原创 Linux ./configure --prefix命令

http://blog.csdn.net/xiyangfan/archive/2010/02/24/5321790.aspx http://blog.dormforce.net/rox/2008/09/26/configure-prefi

原创 linux下iconv()函數的用法

轉載自:http://blog.csdn.net/jnbbwyth/article/details/6991371 linux shell 配置文件中默認的字符集編碼爲UTF-8 。UTF-8是unicode的一種表達方式,gb2312

原创 類構造函數失敗,如何返回NULL

#include <string.h> #include <stdio.h> #include <string> using namespace std; class Myclass { public: Myclass(); vo

原创 gdb調試與信號

九、信號(Signals)信號是一種軟中斷,是一種處理異步事件的方法。一般來說,操作系 統都支持許多信號。尤其是UNIX,比較重要應用程序一般都會處

原创 循環使用strrchr要注意的問題

直接上菜 #include <iostream> using namespace std; #include <string> #include <string.h> #include <stdio.h> #define RC_FAILU

原创 關於C中函數參數,指針-常量-引用解釋的4個函數例子

#include <string.h> #include <stdio.h> void a( int* & k) { k = (int*)10; *k = 10; } void a(const int* & k) { k = (

原创 linux下判斷路徑是否存在的3種方法

#include<iostream> #include<sys/types.h> #include<dirent.h> #include<sys/stat.h> #include<unistd.h> using namespace st

原创 消息隊列接口API(posix 接口和 system v接口)

消息隊列 posix API 消息隊列(也叫做報文隊列)能夠克服早期unix通信機制的一些缺點。信號這種通信方式更像\"即時\"的通信方式,它要求接受信號的進程在某個時間範圍內對信號做出反應,因此該信號最多在接受信號進程的生命週期內纔有意

原创 宏名字不規範,與結構體的成員重名

報錯提示:   定義了宏名字不規範,與結構體的成員重名,導致了編譯的時候提示結構體的這個類型不識別,很久才排除了這個錯誤! 那麼可以通過看預編譯的源代碼來分析是否被宏進行了替換   轉載自:http://hi.baidu.com/hp_r

原创 加快make速度的2個方案預編譯頭與ccache的比較

Precompiled headers 是將頭文件編譯成一個單獨的文件,如果其他地方要以用這個頭文件就會快很多 方法是:用gcc 直接編譯頭文件 Ccache 有2種模式,direct mode與preprocessor mode。