robust c++ code