如何实现与在C消息嵌套的try-catch-finally语句异常 [英] How do I implement exceptions with nestable try-catch-finally statement with messages in C
问题描述
我在找实现与嵌套的try-catch-最后使用的longjmp / setjmp的在C消息声明例外。
I'm looking to implement exceptions with nestable try-catch-finally statement with messages in C using longjmp/setjmp.
我已经成功地实现的try-catch-ELSE例外,他们不是嵌套。我也希望将消息添加到例外。任何想法,我如何能够做到这一点?
I've managed to implement try-catch-else exceptions, they are not nestable. I'm also hoping to add messages to the exceptions. Any idea how I might be able to do it?
推荐答案
戴夫·汉森已经做了的非常好的包装异常宏为他的优秀著作的一部分的 I2C接口和实现的。你既可以用code批发或借鉴其技术。对于任何人谁做C编程相当数量的,这本书是值得购买—它会改变你改变对C&NBSP的方式;程序,它会告诉你如何做面向对象的设计以  C。
Dave Hanson has already done a really nice package of exception macros as part of his excellent book C Interfaces and Implementations. You could either use the code wholesale or learn from his techniques. For anyone who does a fair amount of C programming, the book is worth buying—it will change the way you change about C programming, and it will show you how to do object-oriented design in C.
这篇关于如何实现与在C消息嵌套的try-catch-finally语句异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!