3 ms·
C++ dev for 20+ years. I refused to use them, they encapsulated everything with C++ I hated. A ton of implicit actions and gotchas. It's a gun in hand, foot in
by thefourthchime 3y ago
C++ dev for 20+ years. I refused to use them, they encapsulated everything with C++ I hated. A ton of implicit actions and gotchas. It's a gun in hand, foot in target.
- jnwatson 3y agostreams is the best evidence that C++ was an experiment. It was a sandbox to try a bunch of different language ideas. Overloading the shift operators for this purpose is prima facie insane, and anyone who has single-stepped through a C++ "hello world" program can figure out it isn't remotely efficient, but it was certainly creative.
- otabdeveloper4 3y agoThe 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.
- deleted 3y ago[deleted]
- pjmlp 3y agoUsing C++ since 1993, I love them.