Anonymous namespaces: Are they really that great?

前端 未结 3 1342
一向
一向 2021-02-05 12:15

I have been using the static keyword a long time for defining internal linkage. Later, I switched to the C++ style of wrapping local things in anonymous namespaces.

3条回答
  •  无人及你
    2021-02-05 12:50

    An anonymous namespace is the only thing that does not let a class declaration pollute the global scope. Very useful when defining a class in a .cpp file.

提交回复
热议问题