C++ Valgrind error Conditional jump or move depends on uninitialised value(s) -


i have problem c++ code valgrind giving me error (conditional jump or move depends on uninitialized value(s)) @ lines highlighted below. tried initializing "type" empty string, doesn't seems working. here appreciated.

many in advance.

nandanator

int ab_cd::checktype(string & str) {     int tmp = 0;      string type;       while (getnextsubstring(str, type))     {         if (type == "aaa")     <<<<< ----- valgrind error pointing here          {             tmp |= static_cast<int>(type_aaa);         }         else if (type == "bbb") <<<<< ----- valgrind error pointing here          {             tmp |= static_cast<int>(type_bbb);         }         else if (type == "ccc") <<<<< ----- valgrind error pointing here          {             tmp |= static_cast<int>(type_ccc);         }         else     {         //print warning     }      }      return tmp;  }    bool ab_cd::getnextsubstring(string & input, string & substring) {     bool found_substring = false;      string::size_type start = input.find_first_not_of(" ,");     string::size_type end = input.find_first_of(" ,", start);      if (start != string::npos)     {         substring = input.substr(start, end-start);         input.erase(start, end-start);         found_substring = true;     }     return found_substring; } 


Comments

Popular posts from this blog

javascript - Karma not able to start PhantomJS on Windows - Error: spawn UNKNOWN -

c# - Display ASPX Popup control in RowDeleteing Event (ASPX Gridview) -

Nuget pack csproj using nuspec -