私はこのコードを持っています.CBStringは、何らかの処理に使用する単なる文字列クラスです
char * scrummyconfigure::dosub(strtype input)
{
CBString tstring;
tstring = input;
uint begin;
uint end;
begin = tstring.findchr('$');
end = tstring.findchr('}',begin);
CBString k = tstring.midstr(begin+2,end-2); // this is BASE
strtype vname = (strtype) ((const unsigned char*)k);
strtype bvar = (strtype) "BASE";
assert(strcmp(bvar,vname) == 0); // this never fails
// theconf is just a struct with the map subvars
// subvars is a map<const char *, const char *>
out(theconf->subvars[bvar]); // always comes up with the value
out(theconf->subvars[vname]); // always empty
uint size = end - begin;
tstring.remove(begin, size);
return (const char *)tstring; // it's OKAY! it's got an overload that does things correctly
//inline operator const char* () const { return (const char *)data; } <-- this is how it is declared in the header of the library
}
strcmp が常に文字列が同じであると言うのに、bvar として宣言した変数だけが何かを返すのはなぜですか?