Posts Tagged “c++”:

C++: Argument-dependent name lookup

Sometimes C++ still surprises me. Consider this code:
 namespace ns1 { class C1 { }; void f1(const C1&) { } } int main() { ns1::C1 c1; f1(c1); return 0; } 
If you think it's wrong and causes a compiler error, you're wrong. The... [Read More]

The buggy const

In C/C++, there are constants and pointer to constants. I'm talking here about constants (i.e., `const int var1; int* const var2`) and not pointer to constants (i.e., `const int* var3`). In 90% of cases that I see, usage of constants for **local "variables" and parameters** is "wrong". People seems to... [Read More]