The use of C++ exception handling constructs: A comprehensive study

Rodrigo Bonifacio, Fausto Carvalho, Guilherme N. Ramos, Uira Kulesza, Roberta Coelho
2015 2015 IEEE 15th International Working Conference on Source Code Analysis and Manipulation (SCAM)  
Exception handling (EH) is a well-known mechanism that aims at improving software reliability in a modular way-allowing a better separation between the code that deals with exceptional conditions and the code that deals with the normal control flow of a program. Although the exception handling mechanism was conceived almost 40 years ago, formulating a reasonable design of exception handling code is still considered a challenge, which might hinder its widespread use. This paper reports the
more » ... s of an empirical study that use a mixedmethod approach to investigate the adoption of the exception handing mechanism in C++. Firstly, we carried out a static analysis investigation to understand how developers employ the exception handling construct of C++, considering 65 open-source systems (which comprise 34 million lines of C++ code overall). Then, to better understand the findings from the static analysis phase, we conducted a survey involving 145 C++ developers who have contributed to the subject systems. Some of the findings consistently detected during this mixed-method study reveal that, for several projects, the use of exception handling constructs is scarce and developers favor the use of other strategies to deal with exceptional conditions. In addition, the survey respondents consider that incompatibility with existing C code and libraries, extra performance costs (in terms of response time and size of the compiled code), and lack of expertise to design an exception handling strategy are among the reasons for avoiding the use of exception handling constructs. 978-1-4673-7529-0/15/$31.00 c 2015 IEEE SCAM 2015,
doi:10.1109/scam.2015.7335398 dblp:conf/scam/BonifacioCRKC15 fatcat:4cqmzupobnhbfikpsdo2jshjmm