title: Function prototypes and argument coercion
body: <p>From my C++ textbook</p>
  
  <blockquote>
    <p>an important feature of function prototypes is argument coercion
    - i.e, forcing argument to the appropriate types specified by the parameter declaration. For example, a program can call a function with
    an integer argument, even though the function prototype specifies a
    double argument - the function will still work correctly.</p>
  </blockquote>
  
  <p>So i've tryied</p>
  
  <pre><code>#include &lt;iostream&gt;
  
  // void foo(double);
  
  void foo(double a) {
  
     std::cout &lt;&lt; sizeof(a) &lt;&lt; std::endl;
  }
  
  int main (void){
  
     int a = 1;
     std::cout &lt;&lt; sizeof(a) &lt;&lt; std::endl;
     foo(a);
  
     return 0;
  }
  </code></pre>
  
  <p>and with <strong>or without prototype</strong> it prints correctly first 4 then
  (inside function) 8.</p>
  
  <p>Is my compiler that checks function definition in absence of
  prototypes (that may be not strict C++ standard, but
  useful too) or I have missed something?</p>