
1 Sep
2011
1 Sep
'11
6:10 a.m.
2011/9/1 Agustín K-ballo Bergé <kaballo86@hotmail.com>
On 01/09/2011 2:14, Julien Nitard wrote:
Out of curiosity, would a static member function with a static variable solve that kind of issue ? (Let's forget potential threading issues mentioned in the Singularity discussion).
It can't, you will end up with a different function static variable for each translation unit.
This isn't the case. If you have an inline function with a static variable in it, it'll be the same variable in all translation units. *7.1.2p4 A static local variable in an extern inline function always refers to the same object.* Roman Perepelitsa.