warning C4715: 'compare' : not all control pathsreturn a value
来源:互联网 发布:光通讯网络交换机 编辑:程序博客网 时间:2024/06/18 07:18
template <typename T, typenameL>
int compare( const T& strA, constL& strB )
{
stringstr_A(strA), str_B(strB); //用C风格的数组构造string对象
try
{
if( str_A > str_B )
return 1;
else if ( str_A == str_B )
return 0;
else
return -1;
}
catch(exception ex)
{
cout << "compareexception!" << endl;
}
return 0;
}
如果省略最后那个返回语句,则在“出现异常跳过条件判断则无返回,使catch块代码执行单其没有返回语句”
种情况下会没有返回值,故会出现warning C4715: 'compare' : not all control pathsreturn a value错误。所以最后一个返回语句不能省。
int compare( const T& strA, constL& strB )
{
}
如果省略最后那个返回语句,则在“出现异常跳过条件判断则无返回,使catch块代码执行单其没有返回语句”
种情况下会没有返回值,故会出现warning C4715: 'compare' : not all control pathsreturn a value错误。所以最后一个返回语句不能省。
- warning C4715: 'compare' : not all control pathsreturn a value
- VS2010报错:warning C4715:not all control paths return a value
- What does “warning: not all control paths return a value” mean? (C++)
- chuzhan not all control paths return a value*/
- Not all code paths return a value
- SQL : Compare a column's value is null or not ? is null
- 出现not all code paths return a value错误的原因
- C#构建代码出现not all code paths return a value错误
- warning C4715 不是所有的控件路径都返回值
- Suppress -Wtautological-compare warning
- faad warning: Bitstream value not allowed by specification
- svn: warning: '.' is not a working copy
- Warning: connect.static is not a function
- Value control
- #Hive#Hive Warning: Value had a \n character in it
- compare with zero value
- id hava not a defult value
- value.toFixed is not a function
- 单表密码的C语言实现
- C++ string构造函数详解
- 让人头痛的软回车符替换成回车符
- 我的第一个Android软件作品
- C++ string class
- warning C4715: 'compare' : not all control pathsreturn a value
- C++函数模板
- 数组引用语法表达
- C++ for_each函数\for_each模板
- 本地MSDN Libary突然打不开
- C++ typename关键字的作用
- 7z格式多卷压缩文件使用winRAR解压…
- windows上的cmd内中粘贴复制方便方…
- RSS订阅功能看新闻无广告