c++ - C4716 function must return a value thown despite returning a value -
the problem compiler (mingw32) insists there compilier error @ line 21 in "util.h".
#ifndef util_h #define util_h #include <string> #include <list> #include "treeitem.h" using namespace std; #include <algorithm> #include <functional> #include <cctype> #include <locale> #include <qlist> static inline string <rim(string &s){} static inline string &rtrim(string &s){} static inline string &trim(string &s){} static inline string func_1(string txt,size_t start, size_t end){} static inline size_t func_2(string txt, size_t index){} static inline string replace(string& str, const string& from, const string& to){} vector<treeitem *> parse(string dat){} #endif // util_h
line 21 placeholder function in "util.cpp". (snippet of util.cpp)
vector<treeitem *> parse(string dat) { vector<treeitem *> final {}; while (dat.find("{") <= dat.length()){ treeitem * temp = new treeitem; temp->settext(qstring::fromstdstring(replace(replace(replace(replace(trim(func_1(dat,0,dat.find('{'))),"\n","")," ",""),"}",""),"=",""))); qlist<treeitem *> ref = parse(func_1(dat, dat.find("{")+1,func_2(dat,dat.find('{')))); for(int j = 0; j < ref.size(); j++) { temp->setparent(ref.at(j)); final.push_back(temp); dat = func_1(dat,func_2(dat,dat.find('{')),dat.length()); } } return final; }
obviously returns compiler shouldn't giving error. isn't problem loop evaluating true because if move "return final;" in front of loop still throws error.
the problems in lines:
static inline string <rim(string &s){} static inline string &rtrim(string &s){} static inline string &trim(string &s){} static inline string func_1(string txt,size_t start, size_t end){} static inline size_t func_2(string txt, size_t index){} static inline string replace(string& str, const string& from, const string& to){} vector<treeitem *> parse(string dat){}
all of them provide empty implementation, not declarations. if want them declarations, need replace {}
;
.
static inline string <rim(string &s); static inline string &rtrim(string &s); static inline string &trim(string &s); static inline string func_1(string txt,size_t start, size_t end); static inline size_t func_2(string txt, size_t index); static inline string replace(string& str, const string& from, const string& to); vector<treeitem *> parse(string dat);
Comments
Post a Comment