An Empirical Study of Goto in C Code from GitHub Repositories

被引:23
作者
Nagappan, Meiyappan [1 ]
Robbes, Romain [2 ]
Kamei, Yasutaka [3 ]
Tanter, Eric [2 ]
McIntosh, Shane [4 ]
Mockus, Audris [5 ]
Hassan, Ahmed E. [6 ]
机构
[1] Rochester Inst Technol, Rochester, NY 14623 USA
[2] Univ Chile, Comp Sci Dept DCC, Santiago, Chile
[3] Kyushu Univ, Nishi Ku, Fukuoka 812, Japan
[4] McGill Univ, Montreal, PQ, Canada
[5] Univ Tennessee, Knoxville, TN USA
[6] Queens Univ, Kingston, ON, Canada
来源
2015 10TH JOINT MEETING OF THE EUROPEAN SOFTWARE ENGINEERING CONFERENCE AND THE ACM SIGSOFT SYMPOSIUM ON THE FOUNDATIONS OF SOFTWARE ENGINEERING (ESEC/FSE 2015) PROCEEDINGS | 2015年
关键词
Use of goto statements; Empirical SE; Github; Dijkstra;
D O I
10.1145/2786805.2786834
中图分类号
TP31 [计算机软件];
学科分类号
081202 ; 0835 ;
摘要
It is nearly 50 years since Dijkstra argued that goto obscures the flow of control in program execution and urged programmers to abandon the goto statement. While past research has shown that goto is still in use, little is known about whether goto is used in the unrestricted manner that Dijkstra feared, and if it is 'harmful' enough to be a part of a post-release bug. We, therefore, conduct a two part empirical study- (1) qualitatively analyze a statistically representative sample of 384 files from a population of almost 250K C programming language files collected from over 11K GitHub repositories and find that developers use goto in C files for error handling (80.21 +/- 5%) and cleaning up resources at the end of a procedure (40.36 +/- 5%); and (2) quantitatively analyze the commit history from the release branches of six OSS projects and find that no goto statement was removed/modified in the post-release phase of four of the six projects. We conclude that developers limit themselves to using goto appropriately in most cases, and not in an unrestricted manner like Dijkstra feared, thus suggesting that goto does not appear to be harmful in practice.
引用
收藏
页码:404 / 414
页数:11
相关论文
共 23 条
  • [1] Alnaeli S. M., 2012, 2012 19th Working Conference on Reverse Engineering (WCRE), P377, DOI 10.1109/WCRE.2012.47
  • [2] [Anonymous], 1973, SIGPLAN Not, DOI DOI 10.1145/953353.953355
  • [3] [Anonymous], 2012, THESIS
  • [4] Bruntink M., 2006, 28th International Conference on Software Engineering Proceedings, P242, DOI 10.1145/1134285.1134320
  • [5] Chou A., 2001, Operating Systems Review, V35, P73, DOI 10.1145/502059.502042
  • [6] Deursen Arie van, 2015, LEARNING APPLEAAZS G
  • [7] Dijkstra E. W., 2001, WHAT LED NOTES STRUC
  • [8] Dijkstra Edsger W., 2005, COMMUNICATION
  • [9] GO TO STATEMENT CONSIDERED HARMFUL
    DIJKSTRA, EW
    [J]. COMMUNICATIONS OF THE ACM, 1968, 11 (03) : 147 - &
  • [10] Duncavage D. P., 2014, NASA NEEDS POSTGRES