title: Is this correct way to fix ambiguous function call
body: <p>I have code like this:</p>
  
  <pre><code>#include &lt;cstdio&gt;
  
  void test(size_t const pos){
      printf("size_t\n");
  }
  
  void test(const void *ptr){
      printf("ptr\n");
  }
  
  //void test(int const pos){
  //  printf("int\n");
  //}
  
  int main(){
      size_t x = 0;
  
      test(x);
      test(nullptr);
      test(&amp;x);
  //  test(0);
  // some more that fail, but I do not care too much about them:
  //  test(0U);
  //  test(0L);
  //  test(NULL);
  }
  </code></pre>
  
  <p>When I un-comment <code>test(0);</code> it does not compile, because the compiler does not know how to convert '0'.</p>
  
  <p>If I introduce 'int' overload, everything compiles again.</p>
  
  <p>Is this correct way to avoid ambiguous function call?</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>Correct would mean - I want not to call pointer overload, except in case argument is pointer or <code>nullptr</code> is passed.</p>
  
  <p>I am aware that current "setup" fails with <code>0U</code>, <code>0L</code>, <code>NULL</code>.</p>