-
Recent Posts
Recent Comments
Categories
Links
Daily Archives: May 8, 2020
C/C++中macro的ifndef
以下節錄一段icu unicode lib的文件裡的sample 理論上,這類的macro會定義在header file,而一般header file都會有include guard,所以不會重複include那為什麼要在U_CHARSET_IS_UTF8再檢查一次是否定義過呢? 主要的原因是發生了不在此header定義了這個macro可能來自於其他header,也可能來自於compiler參數例如 g++ … -DU_CHARSET_IS_UTF8=1 這樣就可以透過makefile來做一些動態的macro值改變的處理
Posted in C++ Language
Leave a comment