Re: [問題] 為什麼作業系統都用C寫? 而不用C++呢?

看板C_and_CPP作者 (三億兩千萬大散戶)時間15年前 (2009/03/07 20:25), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串16/37 (看更多)
回應littleshan 1. in header file struct FS { int (*remove)(const char *path); }; #define FS(type) type##_fs in local_fs.c static int remove(const char *path){...} struct FS local_fs; local_fs.remove = remove; in remote_fs.c static int remove(const char *path){...} struct FS remote_fs; remote_fs.remove = remove; Then you can call anywhere like, struct FS *fsp = &FS(remote); fsp->remove("filename"); 2. lock(r1); if(...) goto exit1; lock(r2) if(...) goto exit2; ... exit2: unlock(r2); exit1: unlock(r1); -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 115.83.188.241 ※ 編輯: meltice 來自: 115.83.188.241 (03/07 20:34)
文章代碼(AID): #19icVMri (C_and_CPP)
討論串 (同標題文章)
以下文章回應了本文
完整討論串 (本文為第 16 之 37 篇):
文章代碼(AID): #19icVMri (C_and_CPP)