I would say that the second use is rather unusual, at least in the code that I have seen so far (and I have seen quite a lot of C ++ code). Could you explain what the second method explains?
Usually you use an anonymous namespace in the C ++ implementation file to achieve the same thing as "static" in C (or C ++, but we will mask it), namely limiting the visibility of characters to the current translation unit. Typedef does not actually create characters that are exported for the linker to see, because they do not create anything βspecificβ in the sense of anything specific that you could associate with.
My recommendation? I would go with the first notation. The second adds an unnecessary complication and, in my opinion, does not buy anything.
Timo geusch
source share