CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Feb 2003
    Location
    Brazil
    Posts
    335

    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.

  2. #2
    Join Date
    Dec 2005
    Location
    Prague, Czech Republic
    Posts
    208

    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.

  3. #3
    Join Date
    Feb 2005
    Location
    "The Capital"
    Posts
    5,306

    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.

  4. #4
    Join Date
    Apr 2006
    Location
    Nr Cambridge, UK
    Posts
    263

    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!

  5. #5
    Join Date
    Feb 2003
    Location
    Brazil
    Posts
    335

    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
  •  





Click Here to Expand Forum to Full Width

Featured