-
August 7th, 2006, 03:32 PM
#1
Question about io_base::sync_with_stdio(false)
I´ve read that this call before any use of streams will improved performance because it breaks the sincronization of C++ with C on io operations.
questions:
1) It improves the performance only on stardard streams (cerr cin and cout), or any file will have the performance improved?
2) since I use it I can´t make anymore any call to C standard streams (of course only if I call it again with true as parameter) Is this correct?
Thank you.
-
August 7th, 2006, 03:55 PM
#2
Re: Question about io_base::sync_with_stdio(false)
Whether this yields any performance increase is questionable, and definitely implementation specific. You are welcome to test it with profiler and post your results.
1) only standard streams (cin,cout,cerr,...) are affected.
2) you can call them, but as they are not synchronized you may get unexpected results.
Also, i've looked into the standard and it says:
Effects: If any input or output operation has occurred using the standard streams prior to the call, the effect is implementation-defined.
-
August 8th, 2006, 04:16 AM
#3
Re: Question about io_base::sync_with_stdio(false)
Mixing of C++ and C io stream operations is something you should refrain from. Keep it simple, keep it consistent.
Can you help me with my homework assignment?, Before you post!, Use code tags, How to post!, Codeguru technical FAQs, C++ FAQ Lite, Stroustrup: C++ Style and Technique FAQ, Guru of the Week, Comeau C and C++ FAQs, Comeau C++ Templates FAQs, CUJ @ DDJ, Spam threshold
My Blogs : Learning C++ is fun | Abnegator's reflections
Open Threads : C++ Aha! Moments | Nature of work in C++?
-
August 8th, 2006, 08:44 AM
#4
Re: Question about io_base::sync_with_stdio(false)
Finally, note that under VC++'s standard library (by Dinkumware), ios_base::sync_with_stdio(false) is a no-op!
-
August 8th, 2006, 03:00 PM
#5
Re: Question about io_base::sync_with_stdio(false)
Ok, thank you all for your explantions.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|