Why does cpplint discourage Streams?
The main reason that streams may cause an issue is internationalization.
Whenever you need to generate text with dynamic content in a couple different languages, things get awry because each language has its own grammar rules. For example, in English you would use:
void print(std::ostream& out, int i) {
out << "You retrieved ";
switch(i) {
case 0: out << "no file."; return;
case 1: out << "1 file."; return;
default: out << i << " files." return;
}
And that's great right ?
So when you translate to French, you simply decide to move all those 4 sentences parts in a table in which you will look them up by key, and it works!
And then you discover Polish, from the gettext
documentation, here are the plural forms of file (plik):
1 => plik
2,3,4 => pliki
5-21 => pliko'w
22-24 => pliki
25-31 => pliko'w
Hum... suddenly things are getting difficult, right ?
Actually, it can get worse. Not all languages need to place your dynamic entries in the same order!
This is why streams cannot actually be used for internationalized text short of writing an overloadable C++ function for each text to display, and have the translators provide the overloads! Hum...
There are pros and cons for both, Google Style Guide is just very opinionated to ensure consistency as much as possible.
Is this the one that checks c++ against the google c++ coding guidelines? If so, then the reason is that google's c++ guidelines are generally considered to be somewhat eccentric and not really applicable to what many people think is good practice for modern c++.