Remix.run Logo
account42 5 days ago

Those languages need a dedicated operator because they are loosely typed which would make it ambiguous like + in JavaScript.

But C++ doesn't have that problem. Sure, a separate operator would have been cleaner (but | is already used for bitwise or) but I have never seen any bug that resulted from it and have never felt it to be an issue when writing code myself.

_flux 4 days ago | parent [-]

Though then you can have code like "hello" + "world" that doesn't compile and "hello" + 10 that will do something completely different. In some situations you could actually end up with that by gradual modification of the original code..

Granted this is probably a novice-level problem.