Abstract
Preprocessor annotations (e.g., #ifdef in C) enable the development of similar, but distinct software variants from a common code base. One particularly popular preprocessor is the C preprocessor, cpp. But the cpp is also widely criticized for impeding software maintenance by making code hard to understand and change. Yet, evidence to support this criticism is scarce. In this paper, we investigate the relation between cpp usage and maintenance effort, which we approximate with the frequency and extent of source code changes. To this end, we mined the version control repositories of eight open- source systems written in C. For each system, we measured if and how individual functions use cpp annotations and how they were changed. We found that functions containing cpp annotations are generally changed more frequently and more profoundly than other functions. However, when accounting for function size, the differences disappear or are greatly diminished. In summary, with respect to the frequency and extent of changes, our findings do not support the criticism of the cpp regarding maintainability.
- S. Apel, D. Batory, C. Kästner, and G. Saake. FeatureOriented Software Product Lines. Springer, 2013.Google Scholar
- N. Cliff. Ordinal Methods for Behavioral Data Analysis. Erlbaum, 1996.Google Scholar
- J. Cohen. Statistical Power Analysis for the Behavioral Sciences. 2nd ed. Erlbaum, 1988.Google Scholar
- M. L. Collard, H. H. Kagdi, and J. I. Maletic. “An XML-Based Lightweight C++ Fact Extractor”. In: Proceedings of the International Workshop on Program Comprehension (IWPC). IEEE, 2003, pp. 134–143. Google Scholar
Cross Ref
- M. D’Ambros, A. Bacchelli, and M. Lanza. “On the Impact of Design Flaws on Software Defects”. In: Proceedings of the International Conference on Quality Software (QSIC). IEEE, 2010, pp. 23–31. Google Scholar
Digital Library
- I. Deligiannis, M. Shepperd, M. Roumeliotis, and I. Stamelos. “An Empirical Investigation of an ObjectOriented Design Heuristic for Maintainability”. In: Journal of Systems and Software 65.2 (2003), pp. 127– 139. Google Scholar
Digital Library
- M. Di Penta, L. Cerulo, Y.-G. Guéhéneuc, and G. Antoniol. “An Empirical Study of the Relationships Between Design Pattern Roles and Class Change Proneness”. In: Proceedings of the International Conference on Software Maintenance (ICSM). IEEE, 2008, pp. 217–226. Google Scholar
Cross Ref
- A. J. Dobson and A. Barnett. An Introduction to Generalized Linear Models. 3rd ed. CRC Press, 2008.Google Scholar
- S. G. Eick, T. L. Graves, A. F. Karr, J. S. Marron, and A. Mockus. “Does Code Decay? Assessing the Evidence from Change Management Data”. In: IEEE Transactions on Software Engineering (TSE) 27.1 (Jan. 2001), pp. 1–12. Google Scholar
Digital Library
- K. El Emam. A Methodology for Validating Software Product Metrics. Tech. rep. NCR 44142. Ottawa, Ontario, Canada: National Research Council, June 2000.Google Scholar
- K. El Emam, S. Benlarbi, N. Goel, and S. N. Rai. “The Confounding Effect of Class Size on the Validity of Object-Oriented Metrics”. In: IEEE Transactions on Software Engineering (TSE) 27.7 (2001), pp. 630–650. Google Scholar
Digital Library
- M. D. Ernst, G. J. Badros, and D. Notkin. “An Empirical Analysis of C Preprocessor Use”. In: IEEE Transactions on Software Engineering (TSE) 28.12 (Dec. 2002), pp. 1146–1170. Google Scholar
Digital Library
- J.-M. Favre. “Understanding-in-the-Large”. In: Proceedings of the International Workshop on Program Comprehension (IWPC). IEEE, 1997, pp. 29–38. Google Scholar
Cross Ref
- J. Feigenspan, C. Kästner, S. Apel, J. Liebig, M. Schulze, R. Dachselt, M. Papendieck, T. Leich, and G. Saake. “Do Background Colors Improve Program Comprehension in the #ifdef Hell?” In: Empirical Software Engineering 18.4 (Aug. 2013), pp. 699–745. Google Scholar
Digital Library
- G. Ferreira, M. Malik, C. Kästner, J. Pfeffer, and S. Apel. “Do #ifdefs Influence the Occurrence of Vulnerabilities? An Empirical Study of the Linux Kernel”. In: Proceedings of the International Software Product Line Conference (SPLC). ACM, 2016, pp. 65–73. Google Scholar
Digital Library
- K. Gao and T. M. Khoshgoftaar. “A Comprehensive Empirical Study of Count Models for Software Fault Prediction”. In: IEEE Transactions on Reliability 56.2 (2007), pp. 223–236. Google Scholar
Cross Ref
- R. J. Grissom and J. J. Kim. Effect Sizes for Research: A Broad Practical Approach. Erlbaum, 2005.Google Scholar
- T. Hall, S. Beecham, D. Bowes, D. Gray, and S. Counsell. “A Systematic Literature Review on Fault Prediction Performance in Software Engineering”. In: IEEE Transactions on Software Engineering (TSE) 38.6 (2012), pp. 1276–1304. Google Scholar
Digital Library
- T. Hall, M. Zhang, D. Bowes, and Y. Sun. “Some Code Smells Have a Significant but Small Effect on Faults”. In: ACM Transactions on Software Engineering and Methodology (TOSEM) 23.4 (Sept. 2014), 33:1–33:39. Google Scholar
Digital Library
- J. M. Hilbe. Negative Binomial Regression. 2nd ed. Cambridge University Press, 2011. Google Scholar
Cross Ref
- C. Hunsen, B. Zhang, J. Siegmund, C. Kästner, O. Leßenich, M. Becker, and S. Apel. “Preprocessor-Based Variability in Open-Source and Industrial Software Systems: An Empirical Study”. In: Empirical Software Engineering 21.2 (2016), pp. 449–482. Google Scholar
Digital Library
- C. Kästner and S. Apel. “Virtual Separation of Concerns – A Second Chance for Preprocessors”. In: Journal of Object Technology 8.6 (Sept. 2009), pp. 59–78. Google Scholar
Cross Ref
- B. W. Kernighan and D. M. Ritchie. The C Programming Language. Prentice Hall, 1978.Google Scholar
Digital Library
- F. Khomh, M. Di Penta, and Y.-G. Guéhéneuc. “An Exploratory Study of the Impact of Code Smells on Software Change-Proneness”. In: Proceedings of the Working Conference on Reverse Engineering (WCRE). IEEE, 2009, pp. 75–84. Google Scholar
Digital Library
- F. Khomh, M. Di Penta, Y.-G. Guéhéneuc, and G. Antoniol. “An Exploratory Study of the Impact of Antipatterns on Class Change- and Fault-Proneness”. In: Empirical Software Engineering 17.3 (2012), pp. 243– 275. Google Scholar
Digital Library
- D. Le, E. Walkingshaw, and M. Erwig. “#ifdef Confirmed Harmful: Promoting Understandable Software Variation”. In: Proceedings of the Symposium on Visual Languages and Human Centric Computing (VL/HCC). IEEE, 2011, pp. 143–150.Google Scholar
- J. Liebig, S. Apel, C. Lengauer, C. Kästner, and M. Schulze. “An Analysis of the Variability in Forty Preprocessor-Based Software Product Lines”. In: Proceedings of the International Conference on Software Engineering (ICSE). ACM, 2010, pp. 105–114. Google Scholar
Digital Library
- J. Liebig, C. Kästner, and S. Apel. “Analyzing the Discipline of Preprocessor Annotations in 30 Million Lines of C Code”. In: Proceedings of the International Conference on Aspect-Oriented Software Development (AOSD). ACM, 2011, pp. 191–202. fect of Clones on Changeability”. In: Proceedings of the International Conference on Software Maintenance (ICSM). IEEE, 2008, pp. 227–236. Google Scholar
Digital Library
- R. Malaquias, M. Ribeiro, R. Bonifácio, E. Monteiro, F. Medeiros, A. Garcia, and R. Gheyi. “The Discipline of Preprocessor-Based Annotations Does #ifdef TAG n’t #endif Matter”. In: Proceedings of the International Conference on Program Comprehension (ICPC). IEEE, 2017, pp. 297–307. Google Scholar
Digital Library
- D. McFadden. Quantitative Methods for Analyzing Travel Behavior of Individuals: Some Recent Developments. Institute of Transportation Studies, University of California, 1977.Google Scholar
- F. Medeiros, C. Kästner, M. Ribeiro, S. Nadi, and R. Gheyi. “The Love/Hate Relationship with the C Preprocessor: An Interview Study”. In: Proceedings of the European Conference on Object-Oriented Programming (ECOOP). Schloss Dagstuhl–Leibniz-Zentrum für Informatik, 2015, pp. 495–518.Google Scholar
- F. Medeiros, M. Ribeiro, and R. Gheyi. “Investigating Preprocessor-Based Syntax Errors”. In: Proceedings of the International Conference on Generative Programming: Concepts & Experiences (GPCE). ACM, 2013, pp. 75–84. Google Scholar
Digital Library
- F. Medeiros, M. Ribeiro, R. Gheyi, S. Apel, C. Kastner, B. Ferreira, L. Carvalho, and B. Fonseca. “Discipline Matters: Refactoring of Preprocessor Directives in the #ifdef Hell”. In: IEEE Transactions on Software Engineering (TSE) (2017). accepted for publication, p. 16. Google Scholar
Cross Ref
- F. Medeiros, I. Rodrigues, M. Ribeiro, L. Teixeira, and R. Gheyi. “An Empirical Study on Configuration-Related Issues: Investigating Undeclared and Unused Identifiers”. In: Proceedings of the International Conference on Generative Programming: Concepts & Experiences (GPCE). ACM, 2015, pp. 35–44. Google Scholar
Digital Library
- J. Melo, C. Brabrand, and A. Wąsowski. “How Does the Degree of Variability Affect Bug Finding?” In: Proceedings of the International Conference on Software Engineering (ICSE). ACM, 2016, pp. 679–690. Google Scholar
Digital Library
- A. Mockus and L. G. Votta. “Identifying Reasons for Software Changes Using Historic Databases”. In: Proceedings of the International Conference on Software Maintenance (ICSM). IEEE, 2000, pp. 120–130. Google Scholar
Cross Ref
- R. Moser, W. Pedrycz, and G. Succi. “A Comparative Analysis of the Efficiency of Change Metrics and Static Code Attributes for Defect Prediction”. In: Proceedings of the International Conference on Software Engineering (ICSE). ACM, 2008, pp. 181–190. Google Scholar
Digital Library
- S. M. Olbrich, D. S. Cruzes, and D. I. Sjøberg. “Are All Code Smells Harmful? A Study of God Classes and Brain Classes in the Evolution of Three Open Source Systems”. In: Proceedings of the International Conference on Software Maintenance (ICSM). IEEE, 2010, pp. 1– 10. Google Scholar
Digital Library
- T. J. Ostrand, E. J. Weyuker, and R. M. Bell. “Predicting the Location and Number of Faults in Large Software Systems”. In: IEEE Transactions on Software Engineering (TSE) 31.4 (2005), pp. 340–355. Google Scholar
Digital Library
- R. Queiroz, L. Passos, M. T. Valente, C. Hunsen, S. Apel, and K. Czarnecki. “The Shape of Feature Code: An Analysis of Twenty C-Preprocessor-Based Systems”. In: Software & Systems Modeling (SOSYM) 16.1 (2017), pp. 77–96. Google Scholar
Digital Library
- D. Romano and M. Pinzger. “Using Source Code Metrics to Predict Change-Prone Java Interfaces”. In: Proceedings of the International Conference on Software Maintenance (ICSM). IEEE, 2007, pp. 303–312.Google Scholar
- A. Saboury, P. Musavi, F. Khomh, and G. Antoniol. “An Empirical Study of Code Smells in JavaScript Projects”. In: Proceedings of the International Conference on Software Analysis, Evolution, and Reengineering (SANER). IEEE, 2017, pp. 294–305. Google Scholar
Cross Ref
- S. Schulze, J. Liebig, J. Siegmund, and S. Apel. “Does the Discipline of Preprocessor Annotations Matter? A Controlled Experiment”. In: Proceedings of the International Conference on Generative Programming and Component Engineering (GPCE). ACM. 2013, pp. 65– 74.Google Scholar
- D. I. Sjøberg, A. Yamashita, B. C. D. Anda, A. Mockus, and T. Dyba. “Quantifying the Effect of Code Smells on Maintenance Effort”. In: IEEE Transactions on Software Engineering (TSE) 39.8 (2013), pp. 1144–1156. Google Scholar
Digital Library
- F. Z. Sokol, M. Finavaro Aniche, and M. A. Gerosa. “MetricMiner: Supporting Researchers in Mining Software Repositories”. In: Proceedings of the Working Conference on Source Code Manipulation and Analysis (SCAM). IEEE, 2013, pp. 142–146. Google Scholar
Cross Ref
- H. Spencer and G. Collyer. “#ifdef Considered Harmful, or Portability Experience With C News”. In: Proceedings of the USENIX Technical Conference. USENIX Association, 1992, pp. 185–197.Google Scholar
- G. Succi, W. Pedrycz, M. Stefanovic, and J. Miller. “Practical Assessment of the Models for Identification of Defect-Prone Classes in Object-Oriented Commercial Systems Using Design Metrics”. In: Journal of Systems and Software 65.1 (2003), pp. 1–12. Google Scholar
Digital Library
- Y. Zhou, H. Leung, and B. Xu. “Examining the Potentially Confounding Effect of Class Size on the Associations Between Object-Oriented Metrics and ChangeProneness”. In: IEEE Transactions on Software Engineering (TSE) 35.5 (2009), pp. 607–623. Google Scholar
Digital Library
Index Terms
How preprocessor annotations (do not) affect maintainability: a case study on change-proneness
Recommendations
How preprocessor annotations (do not) affect maintainability: a case study on change-proneness
GPCE 2017: Proceedings of the 16th ACM SIGPLAN International Conference on Generative Programming: Concepts and ExperiencesPreprocessor annotations (e.g., #ifdef in C) enable the development of similar, but distinct software variants from a common code base. One particularly popular preprocessor is the C preprocessor, cpp. But the cpp is also widely criticized for impeding ...
Does the discipline of preprocessor annotations matter?: a controlled experiment
GPCE '13: Proceedings of the 12th international conference on Generative programming: concepts & experiencesThe C preprocessor (CPP) is a simple and language-independent tool, widely used to implement variable software systems using conditional compilation (i.e., by including or excluding annotated code). Although CPP provides powerful means to express ...
Does the discipline of preprocessor annotations matter?: a controlled experiment
GPCE '13The C preprocessor (CPP) is a simple and language-independent tool, widely used to implement variable software systems using conditional compilation (i.e., by including or excluding annotated code). Although CPP provides powerful means to express ...







Comments