CppCoreGuidelines SL.io.10 除非你用只用 prinft 函数,不然请先调用 ios_base::sync_with_stdio(false)
31 December 2023
“Unless you use printf-family functions call ios_base::sync_with_stdio(false)”
理由
让 iostream 和 prinf 风格的 I/O 操作同步成本很高。 cin 和 cout 默认和
prinft 同步。
例子
int main() { ios_base::sync_with_stdio(false); // ... use iostreams ... }