From 0694742a317a63c2b94d4345f41759873f5bab73 Mon Sep 17 00:00:00 2001 From: FauziAkram Date: Wed, 15 Apr 2026 20:18:24 +0200 Subject: [PATCH] Remove redundant std::skipws from fresh string streams In C++, all standard input streams (including std::istringstream) are initialized with the skipws format flag enabled by default. Because these stream objects are scoped locally and freshly constructed on each loop iteration, we are guaranteed that skipws is already active. closes https://github.com/official-stockfish/Stockfish/pull/6719 No functional change --- src/uci.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/uci.cpp b/src/uci.cpp index da47ff06c..e17533afd 100644 --- a/src/uci.cpp +++ b/src/uci.cpp @@ -100,7 +100,7 @@ void UCIEngine::loop() { std::istringstream is(cmd); token.clear(); // Avoid a stale if getline() returns nothing or a blank line - is >> std::skipws >> token; + is >> token; if (token == "quit" || token == "stop") engine.stop(); @@ -154,10 +154,10 @@ void UCIEngine::loop() { { std::pair, std::string> files[2]; - if (is >> std::skipws >> files[0].second) + if (is >> files[0].second) files[0].first = files[0].second; - if (is >> std::skipws >> files[1].second) + if (is >> files[1].second) files[1].first = files[1].second; engine.save_network(files); @@ -248,7 +248,7 @@ void UCIEngine::bench(std::istream& args) { for (const auto& cmd : list) { std::istringstream is(cmd); - is >> std::skipws >> token; + is >> token; if (token == "go" || token == "eval") { @@ -330,7 +330,7 @@ void UCIEngine::benchmark(std::istream& args) { for (const auto& cmd : setup.commands) { std::istringstream is(cmd); - is >> std::skipws >> token; + is >> token; if (token == "go") { @@ -381,7 +381,7 @@ void UCIEngine::benchmark(std::istream& args) { for (const auto& cmd : setup.commands) { std::istringstream is(cmd); - is >> std::skipws >> token; + is >> token; if (token == "go") {