An empirical study of goto in C code from GitHub repositories

Authors: Meiyappan Nagappan Romain Robbes Yasutaka Kamei Éric Tanter Shane McIntosh Audris Mockus Ahmed E. Hassan

Venue: FSE   2015 10th Joint Meeting on Foundations of Software Engineering, pp. 404–414, 2008

Year: 2008

Abstract: 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 rep- resentative 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 re- moved/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.

Preprint: PDF

BibTeX:

@inproceedings{meiyappannagappan2008aesogiccfgr,
    author = "Meiyappan Nagappan and Romain Robbes and Yasutaka Kamei and Éric Tanter and Shane McIntosh and Audris Mockus and Ahmed E. Hassan",
    title = "An empirical study of goto in C code from GitHub repositories",
    year = "2008",
    pages = "404–414",
    booktitle = "Proceedings of the 2015 10th Joint Meeting on Foundations of Software Engineering"
}

Plain Text:

Meiyappan Nagappan, Romain Robbes, Yasutaka Kamei, Éric Tanter, Shane McIntosh, Audris Mockus, and Ahmed E. Hassan, "An empirical study of goto in C code from GitHub repositories," 2015 10th Joint Meeting on Foundations of Software Engineering, pp. 404–414