|
[ トップページ ]
[ ____CommandPrompt ] [ ____JScript ] [ ____MySQL ] [ ____Cygwin ] [ ____Java ] [ ____Emacs ] [ ____Make ] [ ____Perl ] [ ____Python ] [ ____OpenGL ] [ ____C# ] [ ____StyleSheet ] [ ____C++ ] [ ____Winsock ] [ ____Thread ] [ ____VisualStudio ] [ ____C ] [ ____Win32API ] [ ____Lua ] [ ____PhotoShop ] ヘッダ検索 ■ PreProcessor
#define の連結記号は \ が行単位ゆえに空白の行でも \ が必要 #define FUNC(cnd, fall_back) \ if ( cnd ) { \ fall_back; \ } // 再定義 は WARNING #define PI 3.14 #define PI 3.1 // typedef の重複はエラー typedef unsigned char foo; typedef unsigned short foo; #define TEST( d ) (int)( (d + d + d) / 3.0f ) # define pi( exp ) printf( #exp" = %d FILE: %s\n", exp, __FILE__ ) // TEST(100) = 100 FILE: main.cpp // printf( "TEST(100)"" = %d FILE: %s\n", (int)( (100 + 100 + 100) / 3.0f ), "main.cpp" ); pi( TEST(100) ); #define NEW(heap) NEW_IMPL(heap, 0, 0, 0) // if()文の中でマクロを使用した際にエラーを起こさない為 #define MY_MESS(mess) do{ fprintf(stderr, mess);}while(0) |
|