4 ms·
The shift operators are literally the nicest and most innocuous design decision of C++ streams. What's broken with them has nothing to do with bikeshedding abo
by otabdeveloper4 3y ago
The shift operators are literally the nicest and most innocuous design decision of C++ streams.
What's broken with them has nothing to do with bikeshedding about operator choice.
- lifthrasiir 3y agoBut still not without problems, because you can't naturally write `cout << x & 0x1f << endl;`...
- snovv_crash 3y agoJust put some brackets like you should for any operator chaining. Explicit over implicit etc.
- lifthrasiir 3y agoBut here `<<` doesn't really feel like an actual operator here, just an ordinary separator like `,`. (Of course, `,` is actually an operator in C++. But anyway.) It is just completely alien to other existing C++ conventions before and after that.
- jarlesincharge 3y agoC++20 ranges went a bitwise operator overload (OR this time).
- lifthrasiir 3y agoThat is more justifiable, as each delimited range is unlikely to be more complex than a call expression. Operator overload is okay, as long as you understand how would operators will be used.
- snovv_crash 3y agoThis is mimicking the bash syntax.
- JohnFen 3y ago> The shift operators are literally the nicest and most innocuous design decision of C++ streams Which just shows how bad streams are. Overloading the shift operators was a terrible decision on multiple levels, but you're right -- that's not the worst streams sin.