title: Is passing an uninitialized variable to another function UB
body: <p>I wonder is it true that just passing an uninitialized variable to a function results in an undefined behavior?</p>
  
  <p>It seems really weird for me.</p>
  
  <p>Suppose that we have the following code:</p>
  
  <pre><code>void open_db(db* conn)
  {
    // Open database connection and store it in the conn
  }
  
  int main()
  {
    db* conn;
    open_db(conn);
  }
  </code></pre>
  
  <p>It seems perfectly legal to me. It doesn't dereference an uninitialized variable nor it doesn't relay on its state. It just passes an uninitialized pointer to another function that stores some data in it via <code>operator new</code> or something like this.</p>
  
  <p>If it's UB, could you quote the exact place where the Standard says so?</p>
  
  <p>And is it also true for other types like <code>int</code>?</p>
  
  <pre><code>void foo(int bar)
  {
    // ...
  }
  
  int main()
  {
    int bar;
    foo(bar); // UB?
  }
  </code></pre>