473,411 Members | 1,997 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,411 software developers and data experts.

cout & cerr

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

Jul 22 '05 #1
1 1494
"regisser" <om******@hotmail.com> wrote in message
news:RY******************@fe09.usenetserver.com...
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
Jul 22 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
by: Dennis Lubert | last post by:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi people, I want to create my own variant of a cout Object, so that I can use different of those for debugging... Like this class, but as a...
2
by: Trevor | last post by:
Hello, Please bear with me, I am trying to learn C++. I am implementing some error/debug functions which format a message and output it to a C++ stream. I would like to design it using one low...
6
by: Omid | last post by:
Hi. I have problems when I try to redirect everything that is sent to cout to a file. I have one piece of code that works and one that does not work. The only difference is which headers I use....
3
by: George B | last post by:
When I redirect standard output, I would like to duplicate a few lines of this output to the console. If I add duplicates of the desired source statements, changing cout to cerr, it works fine,...
25
by: Victor Bazarov | last post by:
In the project I'm maintaining I've seen two distinct techniques used for returning an object from a function. One is AType function(AType const& arg) { AType retval(arg); // or default...
5
by: Matt | last post by:
I am trying to cast an ostream reference to void* and back again. The code below shows the problem isolated from a more complex program. It compiles quietly but seg faults upon execution. //...
5
by: Cliff Martin | last post by:
Hi, I am writing a simple filter type program that can take input from file or stdin, and output to a file or stdout. It would make life much easier if I could assign cin to a ifstream object...
9
by: realrobby | last post by:
Is this possible using ANSI libraries? If I have an exe that calls a black box DLL, and the DLL writes to the console, how can I get my exe to grab what the DLL wrote, modify it, and spit out a...
11
by: Adrian | last post by:
Is it possible to save a copy of cout the same way you can save a copy of stdout in C (I know C version is portable, but unix portable is good enough for me). I have to use a library which...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.