================
@@ -0,0 +1,26 @@
+.. title:: clang-tidy - readability-mark-static
+
+readability-mark-static
+=======================
+
+Detects variable and function can be marked as static.
+
+Static functions and variables are scoped to a single file. Marking functions
+and variables as static helps to better remove dead code. In addition, it gives
+the compiler more information and can help compiler make more aggressive
+optimizations.
+
----------------
PiotrZSL wrote:

Yes it does, because you cannot get access to such variable/function via extern 
in separate TU.

[(2.3)](https://eel.is/c++draft/basic.link#2.3)
When a name has [internal 
linkage](https://eel.is/c++draft/basic.link#def:linkage,internal), the entity 
it denotes can be referred to by names from other scopes in the same 
translation unit[.](https://eel.is/c++draft/basic.link#2.3.sentence-1)

The name of an entity that belongs to a [namespace 
scope](https://eel.is/c++draft/basic.scope.namespace) has internal linkage if 
it is the name of
[(3.1)](https://eel.is/c++draft/basic.link#3.1)
a variable, variable template, function, or function template that is 
explicitly declared static; or


https://github.com/llvm/llvm-project/pull/90830
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to