Hi, given this code <<<< SNIP >>>>> volatile int b,c; class Test1 { protected: int a; public: inline Test1(int va) : a(va) { } /* does not matter wheter */ inline void foo(void) { switch(a) { default: b=0;c=1;break; case 1: b=1;c=2;break; case 2: b=3;c=4;break; case 3: b=4;c=5;break; } } }; static inline void baz(Test1 x) { x.foo(); x.foo(); x.foo(); } int main(void) { const Test1 test(1) ; baz(test); } <<<< SNIP >>>>> two questions: * Can I get gcc to specialize the call to x.foo(), i.e. to compile an optimized version for x.a==1? Or do I need to template-ify my code for this? (*shudder*) any good templating tutorials out there? * If I modify main() like this static const Test1 test(1) ; int main(void) { baz(test); } and then force gcc to always-inline foo(), it does not notice any more that x.a is constant. Templates again? Thanks, -- -- Matthias Urlichs