title: Any guarantees for uninitialised variables?
body: <p>There are many claims that any use of uninitialised variables invokes <a href="https://stackoverflow.com/questions/2397984/undefined-unspecified-and-implementation-defined-behavior">undefined behavior (UB)</a>.<br>
  Perusing the docs, I could not verify that claim, so I would like a convincing argument clarifying  this for both C and C++.<br>
  I expect the same semantics for both, but am prepared to be surprised by subtle or not so subtle differences.</p>
  
  <p>Some examples of using uninitialised variables to get started. Please add others as needed to explain any corner-cases they don't cover.</p>
  
  <pre><code>void test1() {
      int x;
      printf("%d", x);
  }
  
  void test2() {
      int x;
      for(int i = 0; i &lt; CHAR_BIT * sizeof x)
          x = x &lt;&lt; 1;
      printf("%d", x);
  }
  
  void test3() {
      unsigned x;
      printf("%u", x); /* was format "%d" */
  }
  
  void test4() {
      unsigned x;
      for(int i = 0; i &lt; CHAR_BIT * sizeof x)
          x = x &lt;&lt; 1;
      printf("%u", x); /* was format "%d" */
  }
  </code></pre>