【ISO/ANSI/JIS】 C言語なら俺に聞け! Part 132
at TECH
471:デフォルトの名無しさん
07/11/28 21:03:42
>>468
>同時に実装しなければならないならプリプロセッサでの切り分けはできないと思うが
できますよ、というか出来てます。#undef まで書けば同じファイルにすら実装できます。
下の 2 ファイルを用意して test.cpp をプリプロセッサにかけてみてください。
/* ./template/test.cpp */
#ifdef TYPE_A
#define type_ type_ar
#define name_ func_a
#endif
#ifdef TYPE_B
#define type_ type_b
#define name_ func_b
#endif
type_ *name_( type_ *param );
#undef type_
#undef name_
/* ./test.cpp */
#define TYPE_A
#include "./template/test.cpp"
#undef TYPE_A
#define TYPE_B
#include "./template/test.cpp"
#undef TYPE_B
次ページ続きを表示1を表示最新レス表示スレッドの検索類似スレ一覧話題のニュースおまかせリスト▼オプションを表示暇つぶし2ch
5382日前に更新/146 KB
担当:undef