c**a 发帖数: 316 | 1 try
{
int k=2;
while(1)
{
k=k*2+1;
}
}
catch(overflow_error e)
{
int j=0;
}
要如何才能catch 到 overflow exception ? | k**f 发帖数: 372 | 2
Because the compiler generated code does not check the overflow condition
for such simple operations (due to performance reason), let alone throw any
exception. In more sophisticated functions, the implementation may or may
not check overflow, and may or may not throw exception to notify the caller.
【在 c**a 的大作中提到】 : try : { : int k=2; : while(1) : { : k=k*2+1; : } : } : catch(overflow_error e) : {
|
|