2012年1月1日 星期日

union讓一個變數具有多種形態
enum讓文字來代替數字
bit field可以讓你決定要用幾個bit來存資料,以unsigned int為單位
sequential access -> tape
random access -> harddisk

Macro
#define swap(x, y)是一個Macro
Macro是先代替再把參數代入

/* code */和以下兩者等價:
#if 0
   code
#endif

#ifdef DEBUG
   code
#endif

#define HELLO( x ) printf( “Hello, ” #x “\n” );
經過HELLO(JOHN)以後會變成printf( “Hello, ” “John” “\n” );
printf會把這些以空格隔開的字串連接起來

#define TOKENCONCAT( x, y ) x ## y
would cause
TOKENCONCAT( O, K )
to become
OK

當傳入的敘述為false時,assert()會呼叫abort()來終止程式,如果有#def NDEBUG,All subsequent assert statements ignored

abort()和exit()的差別
exit會把某些變數和檔案釋放掉,並且呼叫atexit();
但abort不會做上面這些事情
不過程式結束以後作業系統還是會幫你釋放掉就是了

沒有留言:

張貼留言