title: When should I write the keyword 'static' before a non-member function?
body: <p>I've recently seen a bit on SO about the <code>static</code> keyword before a function and I'm wondering how to use it properly.</p>
  
  <p><strong>1)</strong> When should I write the keyword <code>static</code> before a non-member function?</p>
  
  <p><strong>2)</strong> Is it dangerous to define a static non-member function in the header? Why (not)?</p>
  
  <hr>
  
  <p><em>(Side Question)</em></p>
  
  <p><strong>3)</strong> Is it possible to define a class in the header file in a certain way, so that it would only be available in the translation unit where you use it first? </p>
  
  <p><em>(The reason that I'm asking this is because I'm learning STL and it might be a good solution for my predicates etc (possibly functors), since I don't like to define functions other than member-functions in the cpp file)</em></p>
  
  <p><em>(Also, I think it is related in a way to the original question because according to my current reasoning, it would do the same thing as <code>static</code> before a function does)</em></p>
  
  <h2>EDIT</h2>
  
  <p>Another question that came up while seeing some answers:</p>
  
  <p><strong>4)</strong> Many people tell me I have to declare the static function in the header, and define it in the source file. But the static function is unique to the translation unit. How can the linker know <strong><em>which</em></strong> translation unit it is unique to, since header files do not directly relate to a source file (only when you include them)?</p>