yabo@shuttle ~ $ g++ gest.cc yabo@shuttle ~ $ ./a.out 42 yabo@shuttle ~ $ g++ -DAMD64 gest.cc yabo@shuttle ~ $ ./a.out Amd64 : 42 yabo@shuttle ~ $ cat gest.cc #include // Default : ia32 #define CURRENT_ARCH ia32 #ifdef AMD64 # undef CURRENT_ARCH # define CURRENT_ARCH amd64 #endif struct ia32 {}; struct amd64 {}; template class gest_output { public: void print_int(int arg) const; }; template void gest_output::print_int(int arg) const { std::cout << arg << std::endl; } template<> void gest_output::print_int(int arg) const { std::cout << "Amd64 : " << arg << std::endl; } int main() { gest_output out; out.print_int(42); } yabo@shuttle ~ $