Fun fact about sync_with_stdio

Revision en1, by -is-this-fft-, 2026-01-08 23:20:23

Consider this code:

#include <iostream>

using namespace std;

int main () {
  ios::sync_with_stdio(false);
  ios::sync_with_stdio(true);
}

In GCC, are the C++ streams std::cout etc synchronized with the corresponding C methods like printf?

Answer

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English -is-this-fft- 2026-01-08 23:21:01 14
en1 English -is-this-fft- 2026-01-08 23:20:23 2414 Initial revision (published)