转换:errno =>例外 [英] conversion: errno => exception

查看:45
本文介绍了转换:errno =>例外的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你知道一个类库,它可以转换标准头文件errno.h中列出的错误/返回代码

。进入一个

众所周知的异常层次结构?

是否有人从std:runtime_error中获取它?


问候,

Markus

Do you know a class library that can convert the error/return codes
that are listed in the standard header file "errno.h" into a
well-known exception hierarchy?
Did anybody derive it from "std:runtime_error"?

Regards,
Markus

推荐答案

* Markus Elfring:
* Markus Elfring:
你知道一个类库可以吗?转换标准头文件errno.h中列出的错误/返回代码
进入一个众所周知的异常层次结构?
是否有人从std:runtime_error中派生出来?
Do you know a class library that can convert the error/return codes
that are listed in the standard header file "errno.h" into a
well-known exception hierarchy?
Did anybody derive it from "std:runtime_error"?




为什么你想要一个层次结构? ?


关闭袖口:


void throwStdIoError()

{

throw std :: runtime_error(std :: strerror(std :: errno));

}

-

答:因为它混乱人们通常阅读文字的顺序。

问:为什么这么糟糕?

A:热门帖子。

问:usenet和电子邮件中最烦人的事情是什么?



Why do you want a hierarchy?

Off the cuff:

void throwStdIoError()
{
throw std::runtime_error( std::strerror( std::errno ) );
}
--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?


Alf P. Steinbach写道:
Alf P. Steinbach wrote:
* Markus Elfring:
* Markus Elfring:
你知道一个类库,它可以转换标准头文件errno.h中列出的错误/返回代码
。进入一个众所周知的异常层次结构?
是否有人从std:runtime_error中获取它?
Do you know a class library that can convert the error/return codes
that are listed in the standard header file "errno.h" into a
well-known exception hierarchy?
Did anybody derive it from "std:runtime_error"?



为什么你想要一个层次结构?

关闭袖口:

void throwStdIoError()
抛出std :: runtime_error(std :: strerror(std :: errno));
}



Why do you want a hierarchy?

Off the cuff:

void throwStdIoError()
{
throw std::runtime_error( std::strerror( std::errno ) );
}




捕获异常的函数很难找到实际上错误的内容。

。 />



It would be quite hard for the function that catches the exception to find
out what the error actually is.


* Rolf Magnus:
* Rolf Magnus:
Alf P. Steinbach写道:
Alf P. Steinbach wrote:
* Markus Elfring :
* Markus Elfring:
你知道一个类库,它可以转换标准头文件errno.h中列出的错误/返回代码
。进入一个众所周知的异常层次结构?
是否有人从std:runtime_error中获取它?
Do you know a class library that can convert the error/return codes
that are listed in the standard header file "errno.h" into a
well-known exception hierarchy?
Did anybody derive it from "std:runtime_error"?



为什么你想要一个层次结构?

关闭袖口:

void throwStdIoError()
抛出std :: runtime_error(std :: strerror(std :: errno));
}



Why do you want a hierarchy?

Off the cuff:

void throwStdIoError()
{
throw std::runtime_error( std::strerror( std::errno ) );
}



捕获异常的函数很难找到错误实际上是什么。



It would be quite hard for the function that catches the exception to find
out what the error actually is.




如果它不在投掷电话的范围内,它为什么要关心?


-

答:因为它弄乱了人们通常阅读文字的顺序。

问:为什么这么糟糕?

A:热门帖子。

问:usenet和电子邮件中最烦人的是什么?



If it''s not within the context of the throwing call, why should it care?

--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?


这篇关于转换:errno =>例外的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆