I vaguely remember that it was possible to write something like:
void f(int a, int b=0, bool c=!val);
if some extra stuff was written at the beginning of the arguments list. The example in GCC gives error of val non declared in scope.
Unfortunately, I cannot find any reference on the Internet, so I ask here.
How about overloading f()? It won’t be a problem whether val is const or not.