- 1、本文档共11页,可阅读全部内容。
- 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
- 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
- 5、该文档为VIP文档,如果想要下载,成为VIP会员后,下载免费。
- 6、成为VIP后,下载本文档将扣除1次下载权益。下载后,不支持退款、换文档。如有疑问请联系我们。
- 7、成为VIP后,您将拥有八大权益,权益包括:VIP文档下载权益、阅读免打扰、文档格式转换、高级专利检索、专属身份标志、高级客服、多端互通、版权登记。
- 8、VIP文档为合作方或网友上传,每下载1次, 网站将根据用户上传文档的质量评分、类型等,对文档贡献者给予高额补贴、流量扶持。如果你也想贡献VIP文档。上传文档
查看更多
看一下下面的代码(当然包括错误,以检验splint的功能):?#include int main(int argc,char* argv[]){int a=100; /*没有使用的变量*/int b[8];printf(Hello c\n);b[9]=100; /*明显数组越界 *//* 用到了两个为声明的变量c和d/c=100;d=10;return 0;}??? 现在可以用splint来检查一下,为了检验是否可以检测到数组越界,使用+bounds选项。 splint hi.c +bounds 输出结果:?hi.c: (in function main)hi.c:9:2: Unrecognized identifier: cIdentifier used in code has not been declared. (Use -unrecog to inhibitwarning)hi.c:10:2: Unrecognized identifier: dhi.c:4:6: Variable a declared but not usedA variable is declared but never used. Use /*@unused@*/ in front ofdeclaration to suppress message. (Use -varuse to inhibit warning)hi.c:7:2: Likely out-of-bounds store:b[9]Unable to resolve constraint:requires 7 = 9needed to satisfy precondition:requires maxSet(b @ hi.c:7:2) = 9A memory write may write to an address beyond the allocated buffer. (Use-likely-boundswrite to inhibit warning)hi.c:3:14: Parameter argc not usedA function parameter is not used in the body of the function. If the argumentis needed for type compatibility or future plans, use /*@unused@*/ in theargument declaration. (Use -paramuse to inhibit warning)hi.c:3:25: Parameter argv not usedFinished checking --- 6 code warnings??????? 现在详细看一下结果: 检查结果1:??? ?hi.c:9:2: Unrecognized identifier: cIdentifier used in code has not been declared. (Use -unrecog to inhibitwarning)hi.c:10:2: Unrecognized identifier: dhi.c:4:6: Variable a declared but not usedA variable is declared but never used. Use /*@unused@*/ in front ofdeclaration to suppress message. (Use -varuse to inhibit warning)??????? 这些应该是splint检测到变量c和d没有声明。 检查结果2:??? ?hi.c:7:2: Likely out-of-bounds store:b[9]Unable to resolve constraint:requires 7 = 9needed to satisfy precondition:requires maxSet(b @ hi.c:7:2) = 9A memory write may write to an address beyond the allocated buffer. (Use-likely-boundswrite to inhibit warning)??????? 这些是检查存在数组越界,因为吧b[8]的最大数组序号应该是7,而不是9,所以出现requires 7 = 9; 检查结果3:??? ?hi.c:3:14: Parameter argc not usedA function parameter is not used in the body
您可能关注的文档
- 工程施工标准规范参考.docx
- 用户管理useradd,passwd,chage,usermod,userdel.docx
- 二、三层EtherChannel技术实现方法.docx
- linux下tomcat优化,设置最大连接数,内存,Jconsole监控.docx
- matlab简单命令.docx
- 总感觉有点不对,你也这么觉得?好,这么觉得你就赢了一半了!.doc
- 别在天亮之前离开我.docx
- 【摘】在英国申根国家签证信息(France,Italy,Holand,Belgium,Greece,Spain,Germany).docx
- c语言 第8章作业2.doc
- 暗黑破坏神2符文掉率.doc
- 2022年11月连江县直机关遴选公务员面试真题带答案详解.docx
- 2022年11月遵义市直遴选面试真题回忆版.docx
- 2022年2月伊春市税务系统遴选面试真题回忆版.docx
- 2022年11月朔州市税务系统遴选面试真题回忆版汇总.docx
- 2022年2月秦皇岛市税务系统遴选面试真题回忆版汇总.docx
- 2022年2月焦作市直机关遴选公务员面试真题附详解.docx
- 2022年11月黑龙江省直机关遴选公务员面试真题附详细解析.docx
- 2022年2月潍坊市直机关遴选公务员面试真题附解析.docx
- 2022年2月大同市直遴选面试真题附详解.docx
- 2022年2月巴音郭楞蒙古自治州直机关遴选公务员面试真题带题目详解.docx
最近下载
- 微能WIN-9变频器说明书使用手册.pdf
- 支气管扩张临床路径.docx VIP
- 长方体、正方体表面积和体积专项练习50题(有答案)ok .pdf VIP
- 吉林省长春市东北师范大学附属中学净月实验学校2023-2024学年高一上学期期中质量监测数学试卷(解析).docx VIP
- 2025至2030年中国拉面粉行业投资前景及策略咨询研究报告.docx
- 人教版一二三年级生字表(全) .pdf VIP
- 22J403-1 楼梯 栏杆 栏板(一) (3).pdf VIP
- 高校学科建设的概念与内涵 .pdf VIP
- T∕ZZB 1299-2019 电动剃须刀用提拉须圆刀.docx VIP
- 鲁教版五四制六年级数学下册第七章达标检测卷附答案 .pdf VIP
文档评论(0)