From a stylistic point of view, this may or may not be in order, but the style is subjective.
From a technical point of view, there are several differences:
+----------------+-------------+ | Private Static | File Static | +----------------------------+----------------+-------------+ | Visible by includers | Yes | No | +----------------------------+----------------+-------------+ | Accessible to friend | Yes | No | +----------------------------+----------------+-------------+ | Accessible to all in TU* | No | Yes | +----------------------------+----------------+-------------+ | Require
Technically, therefore, the static variable in the file area (or the variable in the anonymous namespace) can be more confidential, except that it is visible to all the code that follows it in the source file (which changes accessibility somewhat).
I personally prefer them for those objective reasons. I try to keep my headers as empty as possible, because it makes changes without any effect on the client much easier (and I am most often the client!)
Note: if I forgot the difference, say / edit
source share