TweeZcodeCompiler / twee_zcode_compiler

compiler project at FU Berlin
MIT License
3 stars 0 forks source link

PSA: use operator overloading whenever possible #89

Open ottne opened 9 years ago

ottne commented 9 years ago

Operator overloading serves to make code more readable and should be used whenever a library allows it. For example:

// use overloaded assignment operator that takes a char* argument
std::string foo = "foo";
// use compare function
if(foo.compare("bar") == 0) {...}
// use operator overloading, better readabilty
if(foo == "bar") {...}

We should replace all occurences of compare with overloaded comparison operators.