Beyond errno: Error Handling in “C”

David Svoboda
{"title":"Beyond errno: Error Handling in “C”","authors":"David Svoboda","doi":"10.1109/SecDev.2016.045","DOIUrl":null,"url":null,"abstract":"This tutorial covers error handling in C. In many modern languages the recommended mechanism for error handling is exceptions, but C does not support exceptions. Due to its age, C has acquired a plethora of technologies for handling errors. These range from return codes, errno, and abort() to more esoteric techniques like goto chains, setjmp()/longjmp(), and runtime constraint handlers. With the myriad techniques for handling errors, how then is a C programmer expected to handle errors securely? In this tutorial, we will examine the technologies available to the C developer for handling errors. Each technique has its own pros and cons, and we will examine correct and incorrect uses of each, with an eye towards software security and maintainability. We will briefly touch on C++ exceptions, but we intend to focus on platforms where exceptions are not available. The audience is expected to have a beginner’s understanding of C, and they will be given small code examples to understand throughout the tutorial in order to increase their understanding. They can expect to become aware of the most common error-handling technologies widely used and employed by C programmers.","PeriodicalId":166406,"journal":{"name":"2016 IEEE Cybersecurity Development (SecDev)","volume":"130 1","pages":"0"},"PeriodicalIF":0.0000,"publicationDate":"2016-11-01","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"0","resultStr":null,"platform":"Semanticscholar","paperid":null,"PeriodicalName":"2016 IEEE Cybersecurity Development (SecDev)","FirstCategoryId":"1085","ListUrlMain":"https://doi.org/10.1109/SecDev.2016.045","RegionNum":0,"RegionCategory":null,"ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"","JCRName":"","Score":null,"Total":0}
引用次数: 0

Abstract

This tutorial covers error handling in C. In many modern languages the recommended mechanism for error handling is exceptions, but C does not support exceptions. Due to its age, C has acquired a plethora of technologies for handling errors. These range from return codes, errno, and abort() to more esoteric techniques like goto chains, setjmp()/longjmp(), and runtime constraint handlers. With the myriad techniques for handling errors, how then is a C programmer expected to handle errors securely? In this tutorial, we will examine the technologies available to the C developer for handling errors. Each technique has its own pros and cons, and we will examine correct and incorrect uses of each, with an eye towards software security and maintainability. We will briefly touch on C++ exceptions, but we intend to focus on platforms where exceptions are not available. The audience is expected to have a beginner’s understanding of C, and they will be given small code examples to understand throughout the tutorial in order to increase their understanding. They can expect to become aware of the most common error-handling technologies widely used and employed by C programmers.
超越errno:“C”中的错误处理
本教程涵盖C中的错误处理。在许多现代语言中,错误处理的推荐机制是异常,但C不支持异常。由于其历史悠久,C已经获得了大量处理错误的技术。从返回码、errno和abort()到更深奥的技术,如goto链、setjmp()/longjmp()和运行时约束处理程序。有了这么多处理错误的技术,C程序员又该如何安全地处理错误呢?在本教程中,我们将研究C开发人员可用于处理错误的技术。每种技术都有它自己的优点和缺点,我们将检查每种技术的正确和不正确的用法,并着眼于软件的安全性和可维护性。我们将简要介绍c++异常,但我们打算把重点放在异常不可用的平台上。期望读者对C有一个初学者的理解,他们将在整个教程中获得小的代码示例来理解,以增加他们的理解。他们可以期望了解C程序员广泛使用和使用的最常见的错误处理技术。
本文章由计算机程序翻译,如有差异,请以英文原文为准。
求助全文
约1分钟内获得全文 求助全文
来源期刊
自引率
0.00%
发文量
0
×
引用
GB/T 7714-2015
复制
MLA
复制
APA
复制
导出至
BibTeX EndNote RefMan NoteFirst NoteExpress
×
提示
您的信息不完整,为了账户安全,请先补充。
现在去补充
×
提示
您因"违规操作"
具体请查看互助需知
我知道了
×
提示
确定
请完成安全验证×
copy
已复制链接
快去分享给好友吧!
我知道了
右上角分享
点击右上角分享
0
联系我们:info@booksci.cn Book学术提供免费学术资源搜索服务,方便国内外学者检索中英文文献。致力于提供最便捷和优质的服务体验。 Copyright © 2023 布克学术 All rights reserved.
京ICP备2023020795号-1
ghs 京公网安备 11010802042870号
Book学术文献互助
Book学术文献互助群
群 号:604180095
Book学术官方微信
小红书