The Impact of Compiler Warnings on Code Quality in C++ Projects
Paper i proceeding, 2024

Modern compilers often offer a variety of warning flags, which developers can enable to get feedback on code that, while syntactically correct, may be problematic. In the case of C++, one example of such 'correct but problematic' code is code that leads to undefined behavior (UB). The usage of compiler warnings has long been suspected as a way to decrease bugs and increase code quality. However, empirical evidence that supports this hypothesis is rare. In this study, we present evidence from a study of 127 open source C++ projects. We categorize their usage of compiler warnings into five groups based on which warning flags are being used, and analyse the relationship between compiler warnings and five quality metrics (bugs, critical issues, vulnerabilities, code smells, and technical debt) using Bayesian analysis. We conclude that, in general, compiler warnings indeed correlate with, and potentially cause, higher code quality, with the clearest impact being on the number of critical issues in a project. Using stricter warning flags expectantly correlates with higher code quality in our study objects. However, there are substantial differences between projects, which we attribute to the project's individual development culture. That is, while warnings matter, other factors such as quality culture, are likely to be even more important to source code quality.

Code Quality

Compiler Warnings

Bayesian Data Analysis

Författare

Albin Johansson

Student vid Chalmers

Carl Holmberg

Student vid Chalmers

Francisco Gomes

Software Engineering 1

Philipp Leitner

Software Engineering 2

IEEE International Conference on Program Comprehension

26437147 (ISSN) 26437171 (eISSN)

270-279
979-840070586-1 (ISBN)

32nd IEEE/ACM International Conference on Program Comprehension, ICPC 2024
Lisbon, Portugal,

Utvecklarfokuserad prestandaförbättring för programvaruingenjörer

Vetenskapsrådet (VR) (2018-04127), 2019-01-01 -- 2023-12-31.

Ämneskategorier

Programvaruteknik

Datavetenskap (datalogi)

DOI

10.1145/3643916.3644410

Mer information

Senast uppdaterat

2024-07-18