A Study on the Effects of Exception Usage in Open-Source C++ Systems

Authors: Kirsten Bradley Michael W. Godfrey

Venue: 2019 19th International Working Conference on Source Code Analysis and Manipulation (SCAM) , pp. 1-11, 2019

Year: 2019

Abstract: Exception handling (EH) is a feature common to many modern programming languages, including C++, Java, and Python, that allows error handling in client code to be performed in a way that is both systematic and largely detached from the implementation of the main functionality. However, C++ developers sometimes choose not to use EH, as they feel that its use increases complexity of the resulting code: new control flow paths are added to the code, "stack unwinding" adds extra responsibilities for the developer to worry about, and EH arguably detracts from the modular design of the system. In this paper, we perform an exploratory empirical study of the effects of exceptions usage in 2721 open source C++ systems taken from GitHub. We observed that the number of edges in an augmented call graph increases, on average, by 22% when edges for exception flow are added to a graph. Additionally, about 8 out of 9 functions that may throw only do so by propagating a throw from another function. These results suggest that, in practice, the use of C++ EH can add complexity to the design of the system that developers must strive to be aware of.

BibTeX:

@inproceedings{kirstenbradley2019asoteoeuiocs,
    author = "Kirsten Bradley and Michael W. Godfrey",
    title = "A Study on the Effects of Exception Usage in Open-Source C++ Systems",
    year = "2019",
    pages = "1-11",
    booktitle = "Proceedings of 2019 19th International Working Conference on Source Code Analysis and Manipulation
            (SCAM)
        "
}

Plain Text:

Kirsten Bradley and Michael W. Godfrey, "A Study on the Effects of Exception Usage in Open-Source C++ Systems," 2019 19th International Working Conference on Source Code Analysis and Manipulation (SCAM)
        , pp. 1-11