1.C++注釋妙用:
從前曾經看過一種代碼開關
//*(最前面的/是開關,去掉后下面這段代碼就被注釋了!)
codeSegement1;
//*/
后來,在我的實踐中,我又發現了可以在兩段代碼間切換的方法:
//*(最前面的/是開關,去掉后第1段被注釋,第2段有效)
codeSegement1;
/*/
codeSegement2;
//*/
2.NULL定義
#ifndef NULL
#ifdef __cplusplus
#define NULL 0
#else
#define NULL ((void *)0)
#endif
#endif
3. 標準頭文件中都有如下結構(比如stdio.h文件):
#ifndef _INC_STDIO
#define _INC_STDIO
#ifdef __cplusplus
extern "C" {
#endif
/*...
.....
*/
#ifdef __cplusplus
}
#endif
#endif /* _INC_STDIO*/