)1) while coding it;s better to maintain single return statement when method/function handles critical sections and uses locks or other synchronization mechanism
(2) in case of C++, use ++ instead of ++. ++ is more efficient when compared to ++ because post increment will result in copy constructor getting called while pre-increment will not.
(3) it’s always better to initialize the member variables of class as part of class construction using member variable constructors.
Advertisement