The documentation
如果你忽视这个警告会发生什么,
除非在当前作用域之后遇到全局作用域,否则pragma将无效。
因此,看起来您唯一的选择是将pragma移到函数之外。
如果你不在乎
some code here
加入时,先推后弹出。
#pragma float_control( strict, on, push )
bool ClassNameHere::FunctionNameHere(Process::FileInfo *fileInfo, RBF &File, PaveConfig &cfg)
{
//some code here
// code we care about here
}
#pragma float_control(pop)
如果你真的在乎
这里有一些代码
包括在内,创建另一个包含当前位于push和pop之间的代码的函数,将此新函数包围在push和pop中,并从调用新函数
FunctionNameHere
. 类似于
#pragma float_control( strict, on, push )
bool ClassNameHere::HelperForFunctionNameHere (Process::FileInfo *fileInfo, RBF &File, PaveConfig &cfg)
{
// code we care about here
}
#pragma float_control(pop)
bool ClassNameHere::FunctionNameHere(Process::FileInfo *fileInfo, RBF &File, PaveConfig &cfg)
{
//some code here
return HelperForFunctionNameHere(fileInfo, File);
}