How do developers use C++ libraries? An empirical study

C++ libraries provide an abundance of reusable components for writing high-quality programs and are thus widely adopted by software developers. However, to date there is little work investigating how these libraries are actually used in real software. In this paper, we perform an empirical study to investigate the adoption of C++ standard libraries in open-source applications, with the goal to provide actionable information for developers to help them employ libraries more efficiently. To this end, we analyze 379 historical revisions of 30 applications, containing 149 million lines of C++ code, to conduct the experiment. The experimental results show that: (1) three standard libraries (i.e. Containers Library, Utilities Library, and Strings Library) are significantly more often used than other libraries; (2) the new libraries of C++11 (i.e. Regular Expressions Library, Atomic Operations Library, and Thread Support Library) are significantly less often used than the formerlyestablished libraries; (3) the deprecated library constructs (i.e. auto pointers, function objects, and array I/O operations) are not used at a declining frequency; and (4) applications with a larger size do not adopt libraries more frequently. Based on these results, we propose four suggestions, which could help developers learn and use C++ libraries in an efficient way. KeywordsProgramming Language, C++, Library, Empirical Study