What are the basic rules and idioms for operator overloading?

Note: The answers were given in a specific order, but since many users sort answers according to votes, rather than the time they were given, here’s an index of the answers in the order in which they make the most sense: The General Syntax of operator overloading in C++ The Three Basic Rules of Operator … Read more

Which equals operator (== vs ===) should be used in JavaScript comparisons?

This question’s answers are a community effort. Edit existing answers to improve this post. It is not currently accepting new answers or interactions. I’m using JSLint to go through JavaScript, and it’s returning many suggestions to replace == (two equals signs) with === (three equals signs) when doing things like comparing idSele_UNVEHtype.value.length == 0 inside … Read more

What is the “–>” operator in C/C++?

After reading Hidden Features and Dark Corners of C++/STL on comp.lang.c++.moderated, I was completely surprised that the following snippet compiled and worked in both Visual Studio 2008 and G++ 4.4. Here’s the code: #include <stdio.h> int main() { int x = 10; while (x –> 0) // x goes to 0 { printf(“%d “, x); … Read more