title: Prevent standard functions outside of std namespace
body: <p>I am using only header files specific to C++ (e.g. <code>&lt;cstdlib&gt;</code>), however I still get globally-declared functions, and not just functions in the <code>std</code> namespace. Is there a way, perhaps a compiler switch, to prevent that?</p>
  
  <p>For example, the following code:</p>
  
  <pre><code>#include &lt;cstdlib&gt;
  float random() { return 0.0f; }
  int main() { return 0; }
  </code></pre>
  
  <p>Fails to compile under linux, with the following error:</p>
  
  <pre><code>&gt; g++ -c main.cpp main.o
  main.cpp: In function ‘float random()’:
  main.cpp:2:14: error: new declaration ‘float random()’
  /usr/include/stdlib.h:327:17: error: ambiguates old declaration ‘long int random()’
  </code></pre>
  
  <p>or</p>
  
  <pre><code>&gt; clang++ main.cpp -o main.o
  main.cpp:2:7: error: functions that differ only in their return type cannot be overloaded
  float random() { return 0.0f; }
  /usr/include/stdlib.h:327:17: note: previous declaration is here
  extern long int random (void) __THROW;
  </code></pre>
  
  <p>which is caused that <code>stdlib.h</code> "pollutes" the global namespace with its own <code>random</code> function.</p>
  
  <p>Note, that I am not facing these problems when compiling on Windows, using Visual Studio.</p>