c++ - Warning: Wunused-but-set-variable -
i receive warning when compiling program.
in member function 'bool cclientmanager::initializemobtable()': warning: variable 'isnamefile' set not used [-wunused-but-set-variable] bool isnamefile = true; ^
here relevant part of code
bool cclientmanager::initializemobtable() { map<int,const char*> localmap; bool isnamefile = true; ccsvtable namedata; if(!namedata.load("mob_names.txt",'\t')) { fprintf(stderr, "mob_names.txt 파일을 읽어오지 못했습니다\n"); isnamefile = false; } else { namedata.next(); while(namedata.next()) { localmap[atoi(namedata.asstringbyindex(0))] = namedata.asstringbyindex(1); } } // more ... }
i put rest on pastebin because big: http://pastebin.com/hrvlimgn
the warninig on 170 line in file on pastebin.
my question is, how can fix? if comment these lines bit affects program?
"my question is, how can fix?"
you can put
(void)isnamefile;
statement after initialization rid of warning, or remove
bool isnamefile = true;
and
isnamefile = false;
lines, if variable isn't used , won't further (if it's not used because of temporarily commented code).
"if comment these lines bit affects program?"
it shouldn't affect program if remove or comment line. variable isn't used (accessed) other assigning elsewhere. that's warning says.
Comments
Post a Comment