cout & cerr

Discussion in 'C++' started by Mike Wahler, May 24, 2004.

  1. Mike Wahler

    Mike Wahler Guest

    "regisser" <> wrote in message
    news:RYcsc.31010$...
    > Is it true that cin,cout, etc are initialized on first use?


    No. When 'main()' begins (and before any file scope constructors
    are invoked), you are guaranteed that the 'standard streams' e.g.
    'std::cin', 'std::cout', etc. have been initialized and are ready for use.

    > And that no runtime initialization before main is needed;


    Exactly when and how the standard streams are initialized is
    implementation-dependent, but they will be ready for use before
    any file scope constructors or 'main()' begins.

    > the first time the object is
    > accessed,


    ... has no bearing upon anything.

    >it grabs dynamic memory typically like 1K of
    > memory?


    The standard streams might or might not use 'dynamic memory',
    that's implementation-dependent.

    Where did you hear or read of the notions you describe?

    -Mike
     
    Mike Wahler, May 24, 2004
    #1
    1. Advertising

  2. Mike Wahler

    regisser Guest

    Is it true that cin,cout, etc are initialized on first use? And that no runtime initialization before main is needed; the first time the object is accessed, it grabs dynamic memory typically like 1K of memory?

    Thanks
     
    regisser, May 24, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Trevor
    Replies:
    2
    Views:
    516
  2. Rick N. Backer

    cout, cerr and I/O redirection

    Rick N. Backer, Jul 12, 2005, in forum: C++
    Replies:
    2
    Views:
    342
    Ken Wilson
    Jul 15, 2005
  3. Jim Langston

    Overriding std::cout or std::cerr

    Jim Langston, Aug 14, 2006, in forum: C++
    Replies:
    3
    Views:
    660
    Jim Langston
    Aug 15, 2006
  4. Replies:
    0
    Views:
    437
  5. Will Lichtenberger
    Replies:
    3
    Views:
    3,233
    dener
    Nov 5, 2008
Loading...

Share This Page