Archive for April 9th, 2008

Macro 小技巧 [C++ 求生筆記]

Wednesday, April 9th, 2008

假如要寫出以下的Macro[1. 當然最好是用template,這個只是例子]: #define SWAP(a, b) \ temp = (a); \ (a) = (b); \ (b) = temp; float temp; float a = 10; float b = 20; // case 1 SWAP(a,b); // Correct. // case 2 if( a > 10) { ...