title: ostream operator shouldn't be calling overloaded new operator?
body: <p>I am reading Thinking in C++ (Vol 1 - Page-597). I just came across with a concept of overloading the global new/delete operator.</p>
  
  <pre><code>#include &lt;cstdio&gt;
  #include &lt;cstdlib&gt;
  using namespace std;
  void* operator new(size_t sz) {
      printf("operator new: %d Bytes\n", sz);
      void* m = malloc(sz);
      if(!m) puts("out of memory");
      return m;
  }
  void operator delete(void* m) {
      puts("operator delete");
      free(m);
  }
  class S {
      int i[100];
      public:
          S() { puts("S::S()"); }
         ~S() { puts("S::~S()"); }
  };
  int main() {
      puts("creating &amp; destroying an int");
      int* p = new int(47);
      delete p;
      puts("creating &amp; destroying an s");
      S* s = new S;
      delete s;
      puts("creating &amp; destroying S[3]");
      S* sa = new S[3];
      delete []sa;
  }
  </code></pre>
  
  <p>Taking this example it says following :-</p>
  
  <blockquote>
    <p>Notice that printf( ) and puts( ) are used rather than iostreams. This
    is because when an iostream object is created (like the global cin,
    cout, and cerr), it calls new to allocate memory. With printf( ), you
    don’t get into a deadlock because it doesn’t call new to initialize
    itself.</p>
  </blockquote>
  
  <p>Now to check the correctness of above statement, i included iostream library and also added cout statement in say conttructor in hope of getting an infinite loop as i was expecting cout will call new and it will be infinite loop. But it worked normal. No ambiquity or infinite loop. </p>
  
  <p>Am i missing something here??</p>