- 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
- 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
- 4、该文档为VIP文档,如果想要下载,成为VIP会员后,下载免费。
- 5、成为VIP后,下载本文档将扣除1次下载权益。下载后,不支持退款、换文档。如有疑问请联系我们。
- 6、成为VIP后,您将拥有八大权益,权益包括:VIP文档下载权益、阅读免打扰、文档格式转换、高级专利检索、专属身份标志、高级客服、多端互通、版权登记。
- 7、VIP文档为合作方或网友上传,每下载1次, 网站将根据用户上传文档的质量评分、类型等,对文档贡献者给予高额补贴、流量扶持。如果你也想贡献VIP文档。上传文档
查看更多
条款46宁可编译和链接时出错,也不要运行时出错(Clause 46 compile and link errors rather than run errors)
条款46宁可编译和链接时出错,也不要运行时出错(Clause 46 compile and link errors rather than run errors)
Clause 46: error when compiling and linking, and do not run error
Except for very few cases where C++ throws exceptions (for example, memory is exhausted - see clause 7), the concept of runtime error has nothing to do with C++, as in C. No overflow, underflow, except the zero check; no array bounds check, etc.. Once the program has been compiled and linked, you have to rely on yourself - - all consequences. Its like skydiving. Some people find it exciting, while others are crippled by fright. The motivation behind this idea is, of course, efficiency: without running checks, the program will be smaller and faster.
Theres a different way of dealing with this kind of thing. Some languages, such as Smalltalk and LISP, usually check very few errors during compile links, but provide a powerful runtime system for handling errors during execution. Unlike C++, these languages are almost interpreted, providing performance flexibility as well as providing additional flexibility.
Dont forget that you are programming with C++. Even if Smalltalk/LISPs approach is attractive, forget about them. It is often said that we must adhere to the partys line and, in the present case, its implication is to avoid run-time errors. Whenever possible, let the error check go back from the runtime to the link, or, ideally, at compile time.
The benefits of this approach lie not only in the size and speed of the program, but also in reliability. If the program compiles and links, no error information is generated,
You can be sure that no compiler and linker in the program can check for any errors, and thats all. (of course, another possibility is that the compiler or linker has problems, but dont bother us with that possibility.)
The situation is quite different for runtime errors. During a run, the program does not produce any runtime errors, so you can be sure that another different run period will not cause errors?
您可能关注的文档
- 期待可能性(Expectation possibility).doc
- 望闻问切断顽疾——中小企业主六大失败基因(Look, smell, ask, cut away chronic diseases -- six major failure genes of small and medium business owners).doc
- 期待可能性的机能扩张或紧缩(The function of anticipated possibilities expansion or contraction).doc
- 期货公司营业部经营现状(Operation status of Futures Company Sales Department).doc
- 期货交易金玉良言(Futures invaluable advice).doc
- 期货外汇日内炒单的超级技巧(含个人的小系统)(A super skill (including personal, small systems) for speculation on futures exchanges).doc
- 木业知识(Wood knowledge).doc
- 木丝水泥板、美岩水泥板施工方法详细介绍(The construction method of wood cement board, wood wool cement board is introduced in detail).doc
- 木乃伊王妃(Mummy Princess).doc
- 有关电脑上网设置(About computer Internet settings).doc
- 条码员考试试题(Bar code examination questions).doc
- 杨利伟(Yang Liwei).doc
- 杨贵妃香体(The body of Yang Fei Xiang).doc
- 杨鹏17天gre背诵法(Yang Peng 17 days GRE recitation).doc
- 杭州余杭区疾病监测地理信息系统与建立应用(Geographic information system for disease surveillance and its application in Yuhang District of Hangzhou).doc
- 杨玉良科技精英称号申报材料含伪造的leibniz奖,精英称号应立即撤销!(The title of Yang Yuliang's science and technology elite should be cancelled immediately, including the fake Leibniz prize and the elite title!).doc
- 来北京看病实用技巧大全(Practical skills to see a doctor in Beijing).doc
- 杭州小吃地图(Hangzhou snack map).doc
- 杭州市中小学生国学知识网络大赛4(Hangzhou primary and secondary school students knowledge network competition 4).doc
- 杜曼右脑圆点卡学数学(Duman's right brain Polka Dot math).doc
最近下载
- 【同步教学】北师大版数学五年级下册第三单元《分数乘法》单元测试卷2.doc VIP
- 教学大纲_特种设备安全技术.docx VIP
- 个人简历——【标准模板】.doc VIP
- 结构加固方法介绍和选择.ppt VIP
- 【嘉世咨询-2025研报】2025中国两轮电动车行业现状报告.pdf
- 宜宾市叙州区总工会社会化工会工作者招聘笔试真题2022.docx VIP
- 大桥河幸福河湖建设规划方案研究.docx VIP
- 《机械与特种设备安全》教学大纲.pdf VIP
- 2025广东广州市工业和信息化局直属事业单位引进急需人才20人备考试题及答案解析.docx VIP
- 2023年宜宾市叙州区总工会社会化工会工作者招聘考试真题.docx VIP
文档评论(0)