The Love/Hate Relationship with the C Preprocessor: An Interview Study

Authors Flávio Medeiros, Christian Kästner, Márcio Ribeiro, Sarah Nadi, Rohit Gheyi



PDF
Thumbnail PDF

File

LIPIcs.ECOOP.2015.495.pdf
  • Filesize: 0.74 MB
  • 24 pages

Document Identifiers

Author Details

Flávio Medeiros
Christian Kästner
Márcio Ribeiro
Sarah Nadi
Rohit Gheyi

Cite AsGet BibTex

Flávio Medeiros, Christian Kästner, Márcio Ribeiro, Sarah Nadi, and Rohit Gheyi. The Love/Hate Relationship with the C Preprocessor: An Interview Study. In 29th European Conference on Object-Oriented Programming (ECOOP 2015). Leibniz International Proceedings in Informatics (LIPIcs), Volume 37, pp. 495-518, Schloss Dagstuhl – Leibniz-Zentrum für Informatik (2015)
https://doi.org/10.4230/LIPIcs.ECOOP.2015.495

Abstract

The C preprocessor has received strong criticism in academia, among others regarding separation of concerns, error proneness, and code obfuscation, but is widely used in practice. Many (mostly academic) alternatives to the preprocessor exist, but have not been adopted in practice. Since developers continue to use the preprocessor despite all criticism and research, we ask how practitioners perceive the C preprocessor. We performed interviews with 40 developers, used grounded theory to analyze the data, and cross-validated the results with data from a survey among 202 developers, repository mining, and results from previous studies. In particular, we investigated four research questions related to why the preprocessor is still widely used in practice, common problems, alternatives, and the impact of undisciplined annotations. Our study shows that developers are aware of the criticism the C preprocessor receives, but use it nonetheless, mainly for portability and variability. Many developers indicate that they regularly face preprocessor-related problems and preprocessor-related bugs. The majority of our interviewees do not see any current C-native technologies that can entirely replace the C preprocessor. However, developers tend to mitigate problems with guidelines, even though those guidelines are not enforced consistently. We report the key insights gained from our study and discuss implications for practitioners and researchers on how to better use the C preprocessor to minimize its negative impact.
Keywords
  • C Preprocessor
  • CPP
  • Interviews
  • Surveys
  • and Grounded Theory

Metrics

  • Access Statistics
  • Total Accesses (updated on a weekly basis)
    0
    PDF Downloads

References

  1. Iago Abal, Claus Brabrand, and Andrzej Wasowski. 42 Variability bugs in the Linux Kernel: A qualitative analysis. In Proceedings of the International Conference on Automated Software Engineering, ASE. IEEE/ACM, 2014. Google Scholar
  2. Bram Adams, Wolfgang De Meuter, Herman Tromp, and Ahmed E. Hassan. Can we refactor conditional compilation into aspects? In Proceeding of the International Conference on Aspect-Oriented Software Development, AOSD. ACM, 2009. Google Scholar
  3. Bram Adams, Kris De Schutter, Herman Tromp, and Wolfgang De Meuter. The evolution of the Linux build system. Electronic Communications of the European Association for the Study of Science and Technology, 2008. Google Scholar
  4. Steve Adolph, Wendy Hall, and Philippe Kruchten. Using grounded theory to study the experience of software development. Empirical Software Engineering, 16(4), 2011. Google Scholar
  5. Michalis Anastasopoules and Critina Gacek. Implementing product line variabilities. In Proceedings of the Symposium on Software Reusability, SSR. ACM, 2001. Google Scholar
  6. Ira Baxter and Michael Mehlich. Preprocessor conditional removal by simple partial evaluation. In Procedings of the Working Conference on Reverse Engineering, WCRE. IEEE, 2001. Google Scholar
  7. Michael D. Bond and Kathryn S. McKinley. Tolerating memory leaks. In Proceedings of the International Conference on Object-oriented Programming Systems Languages and Applications, OOPSLA. ACM, 2008. Google Scholar
  8. Quentin Boucher, Andreas Classen, Patrick Heymans, Arnaud Bourdoux, and Laurent Demonceau. Tag and prune: A pragmatic approach to software product line implementation. In Proceedings of the International Conference on Automated Software Engineering, ASE. ACM, 2010. Google Scholar
  9. Claus Brabrand and Michael I. Schwartzbach. Growing languages with metamorphic syntax macros. In Proceedings of the Workshop on Partial Evaluation and Semantics-based Program Manipulation, PEPM. ACM, 2002. Google Scholar
  10. JulietM Corbin and Anselm Strauss. Grounded theory research: Procedures, canons, and evaluative criteria. Qualitative Sociology, 13(1), 1990. Google Scholar
  11. Don A. Dillman, Jolene D. Smyth, and Leah Melani Christian. Internet, Phone, Mail, and Mixed-Mode Surveys: The Tailored Design Method. Wiley, 2014. Google Scholar
  12. Michael Ernst, Greg Badros, and David Notkin. An empirical analysis of C preprocessor use. IEEE Transactions on Software Engineering, 28(12), 2002. Google Scholar
  13. Martin Erwig and Eric Walkingshaw. The choice calculus: A representation for software variation. ACM Transaction on Software Engineering and Methodology, 21(1), 2011. Google Scholar
  14. David Evans. Static detection of dynamic memory errors. In Proceedings of the International Conference on Programming Language Design and Implementation, PLDI. ACM, 1996. Google Scholar
  15. Jean-Marie Favre. Understanding-in-the-large. In Proceedings of the International Workshop on Program Comprehension, IWPC, 1997. Google Scholar
  16. Matthew Flatt. Composable and compilable macros:: You want it when? In Proceedings of the International Conference on Functional Programming, ICFP. ACM, 2002. Google Scholar
  17. Uwe Flick. An Introduction to Qualitative Research. SAGE Publications, 2014. Google Scholar
  18. Alejandra Garrido and Ralph Johnson. Challenges of refactoring C programs. In Proceedings of the International Workshop on Principles of Software Evolution, IWPSE, 2002. Google Scholar
  19. Alejandra Garrido and Ralph Johnson. Analyzing multiple configurations of a C program. In Proceedings of the International Conference on Software Maintenance, ICSM. IEEE, 2005. Google Scholar
  20. Alejandra Garrido and Ralph E. Johnson. Embracing the c preprocessor during refactoring. Journal of Software: Evolution and Process, 25(12), 2013. Google Scholar
  21. Brady J. Garvin and Myra B. Cohen. Feature interaction faults revisited: An exploratory study. In Proceedings of the International Symposium on Software Reliability Engineering, ISSRE. IEEE, 2011. Google Scholar
  22. Paul Gazzillo and Robert Grimm. SuperC: parsing all of C by taming the preprocessor. In Proceedings of the International Conference on Programming Language Design and Implementation, PLDI. ACM, 2012. Google Scholar
  23. Doug Gregor. A module system for the C family, 2012. Remarks by Doug Gregor at The sixth general meeting of LLVM Developers and Users. Google Scholar
  24. M. Greiler, A. van Deursen, and Margrete-Anne Storey. Test confessions: A study of testing practices for plug-in systems. In Proceedings of the International Conference on Software Engineering, ICSE, 2012. Google Scholar
  25. Ying Hu, Ettore Merlo, Michel Dagenais, and Bruno Laguë. C/C++ conditional compilation analysis using symbolic execution. In Proceeding of the International Conference on Software Maintenance, ICSM. IEEE, 2000. Google Scholar
  26. Martin Fagereng Johansen, Oystein Haugen, and Franck Fleurey. An algorithm for generating t-wise covering arrays from large feature models. In Proceedings of the International Software Product Line Conference, SPLC, 2012. Google Scholar
  27. Christian Kästner, Sven Apel, and Martin Kuhlemann. Granularity in software product lines. In Proceedings of the International Conference on Software Engineering, ICSE. ACM, 2008. Google Scholar
  28. Christian Kästner, Sven Apel, and Martin Kuhlemann. A model of refactoring physically and virtually separated features. In Proceedings of the International Conference on Generative Programming and Component Engineering, GPCE. ACM, 2009. Google Scholar
  29. Christian Kästner, Paolo Giarrusso, Tillmann Rendel, Sebastian Erdweg, Klaus Ostermann, and Thorsten Berger. Variability-aware parsing in the presence of lexical macros and conditional compilation. In Proceedings of the Object-Oriented Programming Systems Languages and Applications, OOPSLA. ACM, 2011. Google Scholar
  30. Christian Kästner, Klaus Ostermann, and Sebastian Erdweg. A variability-aware module system. In Proceedings of the International Conference on Object Oriented Programming Systems Languages and Applications, OOPSLA. ACM, 2012. Google Scholar
  31. Eugene Kohlbecker, Daniel P. Friedman, Matthias Felleisen, and Bruce Duba. Hygienic macro expansion. In Proceedings of the International Conference on LISP and Functional Programming, LFP. ACM, 1986. Google Scholar
  32. Klaus H. Krippendorff. Content Analysis: An Introduction to Its Methodology. SAGE Publications, 2014. Google Scholar
  33. Maren Krone and Gregor Snelting. On the inference of configuration structures from source code. In Proceedings of the International Conference on Software Engineering, ICSE. IEEE, 1994. Google Scholar
  34. Aditya Kumar, Andrew Sutton, and Bjarne Stroustrup. Rejuvenating C++ programs through demacrofication. In Proceedings of the International Conference on Software Maintenance, ICSM. IEEE, 2012. Google Scholar
  35. Aditya Kumar, Andrew Sutton, and Bjarne Stroustrup. Rejuvenating C++ programs through demacrofication. In Proceedings of the International Conference on Software Maintenance, ICSM. IEEE, 2012. Google Scholar
  36. Steinar Kvale. InterViews: An Introduction to Qualitative Research Interviewing. SAGE Publications, 1996. Google Scholar
  37. David Larochelle and David Evans. Statically detecting likely buffer overflow vulnerabilities. In Proceedings of the USENIX Security Symposium. USENIX Association, 2001. Google Scholar
  38. Jörg Liebig, Sven Apel, Christian Lengauer, Christian Kästner, and Michael Schulze. An analysis of the variability in forty preprocessor-based software product lines. In Proceedings of International Conference on Software Engineering, ICSE. ACM, 2010. Google Scholar
  39. Jörg Liebig, Andreas Janker, Florian Garbe, Sven Apel, and Christian Lengauer. Morpheus: Variability-aware refactoring in the wild. In Proceedings of the International Conference on Software Engineering, ICSE. ACM, 2015. Google Scholar
  40. Jörg Liebig, Christian Kästner, and Sven 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. Google Scholar
  41. Jörg Liebig, Alexander von Rhein, Christian Kästner, Sven Apel, Jens Dörre, and Christian Lengauer. Scalable analysis of variable software. In Proceedings of the Joint Meeting of the European Software Engineering Conference and the Symposium on the Foundations of Software Engineering, FSE. ACM, 2013. Google Scholar
  42. Daniel Lohmann, Fabian Scheler, Reinhard Tartler, Olaf Spinczyk, and Wolfgang Schröder-Preikschat. A quantitative analysis of aspects in the eCos kernel. In Proceedings of the European Conference on Computer Systems, EuroSys. ACM, 2006. Google Scholar
  43. Bill McCloskey and Eric Brewer. Astec: A new approach to refactoring C. In Proceedings of the European Software Engineering Conference and International Symposium on Foundations of Software Engineering, ESEC/FSE. ACM, 2005. Google Scholar
  44. Flávio Medeiros, Márcio Ribeiro, and Rohit Gheyi. Investigating Preprocessor-Based Syntax Errors. In Proceedings of the International Conference on Generative Programming: Concepts and Experiences, GPCE. ACM, 2013. Google Scholar
  45. Flávio Medeiros, Márcio Ribeiro, Rohit Gheyi, and Baldoino Fonseca. A catalogue of refactorings to remove incomplete annotations. Journal of Universal Computer Science, 2014. Google Scholar
  46. Christopher A. Mennie and Charles L. A. Clarke. Giving meaning to macros. In Proceedings of the International Conference on Program Comprehension, ICPC. IEEE, 2004. Google Scholar
  47. Emerson Murphy-Hill, Thomas Zimmermann, and Nachiappan Nagappan. Cowboys, ankle sprains, and keepers of quality: How is video game development different from software development? In Proceedings of the International Conference on Software Engineering, ICSE. ACM, 2014. Google Scholar
  48. Sarah Nadi and Ric Holt. The Linux kernel: A case study of build system variability. Journal of Software: Evolution and Process, 26(8), 2014. Google Scholar
  49. Changhai Nie and Hareton Leung. A survey of combinatorial testing. ACM Computer Surveys, 43(2), 2011. Google Scholar
  50. Jeffrey L. Overbey, Farnaz Behrang, and Munawar Hafiz. A foundation for refactoring C with macros. In Proceeding of the International Symposium on the Foundations of Software Engineering, FSE. ACM, 2014. Google Scholar
  51. Yoann Padioleau. Parsing C/C++ code without pre-processing. In Compiler Construction, volume 5501 of Lecture Notes in Computer Science. Springer, 2009. Google Scholar
  52. T. Troy Pearse and Paul W. Oman. Experiences developing and maintaining software in a multi-platform env. In Proceedings of the International Conference on Software Maintenance, ICSM. IEEE, 1997. Google Scholar
  53. Márcio Ribeiro, Paulo Borba, and Christian Kästner. Feature maintenance with emergent interfaces. In Proceedings of the International Conference on Software Engineering, ICSE, 2014. Google Scholar
  54. Márcio Ribeiro, Felipe Queiroz, Paulo Borba, Társis Tolêdo, Claus Brabrand, and Sérgio Soares. On the impact of feature dependencies when maintaining preprocessor-based software product lines. In Proceedings of the International Conference on Generative Programming and Component Engineering, GPCE. ACM, 2011. Google Scholar
  55. Sandro Schulze, Jörg Liebig, Janet Siegmund, and Sven Apel. Does the discipline of preprocessor annotations matter?: A controlled experiment. In Proceedings of the International Conference on Generative Programming: Concepts and Experiences, GPCE, 2013. Google Scholar
  56. Robert C. Seacord. The: 98 Rules for Developing Safe, Reliable, and Secure Systems. Addison-Wesley, 2014. Google Scholar
  57. Nieraj Singh, Celina Gibbs, and Yvonne Coady. C-CLR: A tool for navigating highly configurable system software. In Proceedings of the AOSD Workshop on Aspects, Components, and Patterns for Infrastructure Software, ACP4IS. ACM, 2007. Google Scholar
  58. Henry Spencer and Geoff Collyer. \#ifdef considered harmful, or portability experience with C news. In USENIX Annual Technical Conference, 1992. Google Scholar
  59. Diomidis Spinellis. Global analysis and transformations in preprocessed languages. IEEE Transactions on Software Engineering, 29(11), 2003. Google Scholar
  60. Reinhard Tartler, Christian Dietrich, Julio Sincero, Wolfgang Schröder-Preikschat, and Daniel Lohmann. Static analysis of variability in system software: The 90,000 \#ifdefs issue. In USENIX Annual Technical Conference, 2014. Google Scholar
  61. Reinhard Tartler, Daniel Lohmann, Julio Sincero, and Wolfgang Schröder-Preikschat. Feature consistency in compile-time-configurable system software: facing the Linux 10,000 feature problem. In Proceedings of the Conference on Computer systems, EuroSys. ACM, 2011. Google Scholar
  62. Reinhard Tartler, Julio Sincero, Christian Dietrich, Wolfgang Schröder-Preikschat, and Daniel Lohmann. Revealing and repairing configuration inconsistencies in large-scale system software. International Journal on Software Tools for Technology Transfer, 14(5), 2012. Google Scholar
  63. Reinhard Tartler, Julio Sincero, Wolfgang Schröder-Preikschat, and Daniel Lohmann. Dead or alive: finding zombie features in the linux kernel. In Proceedings of the International Workshop on Feature-Oriented Software Development, FOSD, 2009. Google Scholar
  64. Thomas Thüm, Sven Apel, Christian Kästner, Ina Schaefer, and Gunter Saake. A classification and survey of analysis strategies for software product lines. ACM Computing Surveys, 47(1), 2014. Google Scholar
  65. Federico Tomassetti and Daniel Ratiu. Extracting variability from C and lifting it to mbeddr. In Proceedings of the International Workshop on Reverse Variability Engineering, REVE, 2013. Google Scholar
  66. Salvador Trujillo, Don Batory, and Oscar Diaz. Feature refactoring a multi-representation program into a product line. In Proceedings of the International Conference on Generative Programming and Component Engineering, GPCE. ACM, 2006. Google Scholar
  67. Marian Vittek. Refactoring browser with preprocessor. In Proceedings of the European Conference on Software Maintenance and Reengineering, CSMR. IEEE, 2003. Google Scholar
  68. Daniel Weise and Roger Crew. Programmable syntax macros. In Proceedings of Internatinoal Conference on Programming Language Design and Implementation, PLDI. ACM, 1993. Google Scholar
Questions / Remarks / Feedback
X

Feedback for Dagstuhl Publishing


Thanks for your feedback!

Feedback submitted

Could not send message

Please try again later or send an E-mail