For instance if I'm using a class like this:
class Class
{
static int f(int a, int b, int c) { return a + b + c; }
int(*A)(int, int, int);
int(*B)(int, int, int);
Class() { A = f; B = f; }
};
I was told that static function will make a silly error if function A
and B
runs simultaneously, but I think there is no other special way to define those function pointers. Does it really make problems in multithread programmings? If it does, how should I change the code to prevent such accidents?
In short, if A
and B
runs simultaneously then will there be a different return value which is not expected?