I'd write a foo_impl which always takes a parameter. Then do the versioned foo() functions which just forward to it:

void foo_impl(int x) { long function using x here }

version(globals) {
   int x;
   void foo() {
      foo_impl(x);
   }
} else {
   void foo(int x) { foo_impl(x); }
}

Minimal duplication with both interfaces.

Reply via email to