c++ - Typedef inside/outside anonymous namespace? -


In a .pip file, is there any difference / preference in any way? File scope outside any namespace using someClass;

  / / X ::; Type FIF: Buffer MyBuff;  

v / s

  namespace {// Anonym using X: some classes; Type FIF: Buffer MyBuff; }  

I would say that the second use is unusual, at least in the code that I just Have seen (and I have seen a lot of C ++ code) Can you explain what the logic behind the second technique is?

You can generally use unknown namespaces in a C ++ implementation file so that 'static' can be in C (or C ++), but we 'will shine on it), that is, Limit the visibility of symbols to the current translation unit. Typeffe does not actually produce the symbols which are exported to the linker because they do not make concrete in the meaning of some concrete which can link against you.

My recommendation? I had to go with the first marking, the second adds an unnecessary complexity and in my opinion, you do not buy anything.


Comments

Popular posts from this blog

c# - How to capture HTTP packet with SharpPcap -

php - Multiple Select with Explode: only returns the word "Array" -

php - jQuery AJAX Post not working -