相关疑难解决方法(0)

抛出异常后返回

在异常return之后,它对任何值都有益throw吗?如果没有,可以return省略语句,是否有可能删除编译器错误C4715: not all control paths return a value

提前致谢.

编辑:(示例代码)

for (ushort i = 0; i < itsNumUnits; ++i)
    if (unitFormation[i] == unit)
    {
        return unitSetup[i];
    }
    else
        throw unit;

return 0;
Run Code Online (Sandbox Code Playgroud)

c++ exception return-value throw

10
推荐指数
1
解决办法
7590
查看次数

标签 统计

c++ ×1

exception ×1

return-value ×1

throw ×1