Developers relax restrictions on a type to reuse methods with other types. While type casts are prevalent, in weakly typed languages such as C++, they are also extremely permissive. If type conversions are performed without care, they can lead to software bugs. Therefore, there is a clear need to check whether a type conversion is essential and used adequately according to the developer's intent. In this paper, we propose a technique to judge the fidelity of type conversions from an explicit cast operation, using the identifiers in an assignment. We measure accord in the identifiers using entropy and use it to check if the semantics of the source expression in the cast match the semantics of the variable it is being assigned. We present the results of running our tool on 34 components of the Chromium project, which collectively account for 27MLOC. Our tool identified 1,368 cases of discord indicating potential anti-patterns in the usage of explicit casts. We performed a manual evaluation of a random-uniform sample of these cases. Our evaluation shows that our tool identified 25.6% cases representing incorrect implementations of named casts and 28.04% cases representing imprecise names of identifiers.


翻译:开发者放松对类型的限制, 使用其他类型的再利用方法。 类型投影很普遍, 使用C++ 等类型类型语言, 类型投影也很普遍, 也非常允许。 如果类型转换不小心地进行, 可能会导致软件错误。 因此, 显然需要检查类型转换是否必要, 并且是否按照开发者的意图适当使用。 在本文中, 我们提出一种方法, 用任务中的标识符来判断类型转换的准确性。 我们使用一个任务中的标识符来测量标识符中的匹配性。 我们使用 entropy 来测量标识符中的匹配性, 并使用它来检查投影中源表达的语义是否匹配所指派变量的语义。 我们展示了在铬项目的34个组成部分上运行我们工具的结果, 共算出 27MLOC 。 我们的工具确定了1, 368个在使用明确投影器时可能出现反模式的不匹配情况。 我们用手评估了这些案例的随机不统一样本。 我们的评估显示, 我们的工具确定了25. 6% 代表不正确执行定模和28.04 % 标识符号的案例 。

0
下载
关闭预览

相关内容

专知会员服务
41+阅读 · 2020年12月18日
Linux导论,Introduction to Linux,96页ppt
专知会员服务
76+阅读 · 2020年7月26日
《动手学深度学习》(Dive into Deep Learning)PyTorch实现
专知会员服务
117+阅读 · 2019年12月31日
深度学习界圣经“花书”《Deep Learning》中文版来了
专知会员服务
230+阅读 · 2019年10月26日
Stabilizing Transformers for Reinforcement Learning
专知会员服务
57+阅读 · 2019年10月17日
Keras François Chollet 《Deep Learning with Python 》, 386页pdf
专知会员服务
145+阅读 · 2019年10月12日
Transferring Knowledge across Learning Processes
CreateAMind
26+阅读 · 2019年5月18日
学术会议 | 知识图谱顶会 ISWC 征稿:Poster/Demo
开放知识图谱
5+阅读 · 2019年4月16日
Unsupervised Learning via Meta-Learning
CreateAMind
41+阅读 · 2019年1月3日
A Technical Overview of AI & ML in 2018 & Trends for 2019
待字闺中
16+阅读 · 2018年12月24日
disentangled-representation-papers
CreateAMind
26+阅读 · 2018年9月12日
已删除
将门创投
4+阅读 · 2018年7月31日
Hierarchical Disentangled Representations
CreateAMind
4+阅读 · 2018年4月15日
Capsule Networks解析
机器学习研究会
11+阅读 · 2017年11月12日
【推荐】SVM实例教程
机器学习研究会
17+阅读 · 2017年8月26日
Arxiv
5+阅读 · 2021年6月3日
A Survey on Deep Learning for Named Entity Recognition
Arxiv
73+阅读 · 2018年12月22日
Arxiv
11+阅读 · 2018年9月28日
Arxiv
15+阅读 · 2018年2月4日
VIP会员
相关资讯
Transferring Knowledge across Learning Processes
CreateAMind
26+阅读 · 2019年5月18日
学术会议 | 知识图谱顶会 ISWC 征稿:Poster/Demo
开放知识图谱
5+阅读 · 2019年4月16日
Unsupervised Learning via Meta-Learning
CreateAMind
41+阅读 · 2019年1月3日
A Technical Overview of AI & ML in 2018 & Trends for 2019
待字闺中
16+阅读 · 2018年12月24日
disentangled-representation-papers
CreateAMind
26+阅读 · 2018年9月12日
已删除
将门创投
4+阅读 · 2018年7月31日
Hierarchical Disentangled Representations
CreateAMind
4+阅读 · 2018年4月15日
Capsule Networks解析
机器学习研究会
11+阅读 · 2017年11月12日
【推荐】SVM实例教程
机器学习研究会
17+阅读 · 2017年8月26日
Top
微信扫码咨询专知VIP会员