我也可以操作的std :: string和MFC CString的一个模板字符串操作类。它workes精细的调试版本。它的发行版本。根据我的调查,我发现至少有一个有用的功能进行了优化。 checkChars被优化这是应该在分割被调用。 (checkChars不被调用。)
static bool checkChars(const TCHARTYPE& c, const TCHARTYPE* chrs)
{
for ( ;*chrs ;chrs++)
{
if (c == *chrs)
{
return true;
}
}
return false;
}
void split(const TSTRING& s, vector<TSTRING>& v, const TCHARTYPE* separator, bool bKeepEmptyParts = false)
{
...
//here at() is called, but checkChars isn't
if (checkChars(at(s, i), separator))
...
}
该VS优化是
最大化速度(/ O2)
。我发现使用
习惯
可以防止我有用的功能优化。但我想知道为什么,我不想改变项目的设置,可我只是修改我的代码,使其工作?
is there any way to disable compiler optimisation for a specific line of code?
http://msdn.microsoft.com/en-us/library/chh3fb0k.aspx
#pragma optimize( "", off )
.
.
.
#pragma optimize( "", on )