Best Angular 17 Classroom & Online training - Naresh IT
An Empirical Study of Goto in C Code from GitHub Repositories
1. An Empirical Study of Goto in C
Code from GitHub Repositories
Mei Nagappan, Romain Robbes, Yasutaka Kamei, Éric
Tanter, Shane McIntosh, Audris Mockus, Ahmed E. Hassan
27. Num of Goto Statements
per Function
Num of Goto Labels
per Function
Not many goto statements per function
28. Num of Goto Statements
per Function
Num of Goto Labels
per Function
Not many goto statements per function
Very few lines of code in label blocks
Median = 4 LOC
30. Context
Why did Dijkstra think goto statements
would have ‘disastrous effects’?
‘The go to statement as it stands is just
too primitive; it is too much an invitation
to make a mess of one’s program.’
45. Most goto usage is for error handling
and cleanup
Error Handling =
80%
Cleanup = 40%
46. Most goto usage is for error handling
and cleanup
Error Handling =
80%
Goto and labels used to emulate a try/catch or
finally mechanism
Cleanup = 40%
48. Less intuitive usages such as control-
exit and loop-create are less common
9%
Most usages of goto statements appear to
be for error handling and cleanup
52. Almost no Gotos are removed/modified
in the post-release phase of a project
0
2
4
6
8
10
12
14
16
Removed
Modified
53. Even fewer Gotos are
removed/modified in the post-release
bug fixes
0
1
2
3
4
5
6
Removed
Modified
54. Even fewer Gotos are
removed/modified in the post-release
bug fixes
0
1
2
3
4
5
6
Removed
Modified
Developers did not remove/modify goto
statements in the post-release phase.