Hacker News new | ask | show | jobs
by gavinray 1792 days ago
I was surprised to read that `and`, `and_eq`, `xor`, etc are all supported "secondary/alternative operators"

Never seen them used, but I use them in my C++ code when I have to write it to accomplish something else:

https://en.cppreference.com/w/cpp/language/operator_alternat...

2 comments

I used to use them. Then I was burned by some Very Opinionated managers and coworkers who didn't like seeing new things. It wasn't a hill I was willing to die on; there's more important things to argue about in C++.
They have been around since the first standard and basically only exist as a hack around an ancient non ascii compatible encoding. So unless you got burned in 1995 nothing about them was new.

They also aren't very consistent between C derived languages. Mostly because C# inherited its versions from VisualBasic, where And is a bitwise operator instead of a short circuiting one.

> * So unless you got burned in 1995 nothing about them was new.*

I didn't mean to imply that they were new features to the language. I meant to imply that they were new style of coding to the manager & coworkers.

Some other features that have burned me from managers & coworkers is `using` to change the visibility of parent class members & functions and CRTP.

Development is a massive cargo cult
I use them, some of them anyway. I find them to be more readable (in particular’not’ instead of ‘!’). Also it means that I can reserve ‘&&’ for rvalue references.