title: Call by pointer become call by reference to pointer
body: <p>I have a couple of errors, where I think I'm calling a function and supplying some variables by pointer and some by value. However, I'm getting compiler errors because, somehow the call by pointer variables are changed to reference to pointer.</p>
  
  <p>Here is the error</p>
  
  <pre><code>g++ -Wall -c -std=c++11  -I.   -c -o SDL_Lesson2.o SDL_Lesson2.cpp
  SDL_Lesson2.cpp: In function ‘int main(int, char**)’:
  SDL_Lesson2.cpp:56:42: error: call of overloaded ‘renderTexture(SDL_Texture*&amp;,     
  SDL_Renderer*&amp;, int, int)’ is ambiguous
  SDL_Lesson2.cpp:56:42: note: candidates are:
  In file included from SDL_Lesson2.cpp:8:0:
  sdlWrapper.hpp:40:6: note: void renderTexture(SDL_Texture*, SDL_Renderer*, int, int)
  sdlWrapper.hpp:54:6: note: void renderTexture(SDL_Texture*, SDL_Renderer*, int, int,    
  SDL_Rect*)
  SDL_Lesson2.cpp:57:43: error: call of overloaded ‘renderTexture(SDL_Texture*&amp;,    
  SDL_Renderer*&amp;, int&amp;, int)’ is ambiguous
  SDL_Lesson2.cpp:57:43: note: candidates are:
  In file included from SDL_Lesson2.cpp:8:0:
  sdlWrapper.hpp:40:6: note: void renderTexture(SDL_Texture*, SDL_Renderer*, int, int)
  sdlWrapper.hpp:54:6: note: void renderTexture(SDL_Texture*, SDL_Renderer*, int, int,    
  SDL_Rect*)
  </code></pre>
  
  <p>The code that is at these lines is:</p>
  
  <pre><code>SDL_Renderer *renderer = SDL_CreateRenderer(win, -1, 
      SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC);
  SDL_Texture* background = loadTexture("./background.bmp", renderer);
  SDL_Texture* image = loadTexture("./image.bmp", renderer);
  ...
  int bW, bH;
  SDL_QueryTexture(background, NULL, NULL, &amp;bW, &amp;bH);
  renderTexture(background, renderer, 0, 0);
  renderTexture(background, renderer, bW, 0);
  </code></pre>
  
  <p>So, I'm wondering, why is the call ambiguous. In my mind, <code>renderTexture(background, renderer, 0, 0)</code> is clearly <code>renderTexture(SDL_Texture*, SDL_Renderer*, int, int)</code>. I'm wrong, but I can't figure out why.</p>
  
  <p>Also, between the two lines the first <code>int</code> changes from calling by value to call by reference. That is also a mystery to me.</p>
  
  <p>I believe the problem comes from two overloaded versions.</p>
  
  <pre><code>void renderTexture(SDL_Texture *tex, SDL_Renderer *ren, int x, int y, int w, int h);
  </code></pre>
  
  <p>and </p>
  
  <pre><code>void renderTexture(SDL_Texture *tex, SDL_Renderer *ren, SDL_Rect dst,
  SDL_Rect *clip = nullptr);
  </code></pre>
  
  <p>These versions, don't look the same to me. But because SDL_Rect is just four ints in a struct I can see how they might be confused for each other by the compiler.</p>
  
  <p>Should I just remoce one of these functions? Or does the problem lie elsewhere, and I'd just be hiding the problem by removing one of the functions?</p>