Comparison of C++ vs. C for Embedded Systems in a Functional Safety Context

  • Philipp Freislich

    Student thesis: Master's Thesis

    Abstract

    Many software developers still share the opinion that C++ is unsuitable for the development of embedded software due to its excessive overhead. For embedded software projects with a focus on efficiency, C is still the programming language of choice. This thesis examines the differences between the programming languages C and C++ on embedded systems in a functional safety context. Primarily, the flash memory usage of the programming languages C and C++ is evaluated in compliance with the functional safety standard MISRA-C/MISRA-C++. The work begins with the theoretical basics of embedded software development and explains the procedure of embedded software evaluation. Subsequently, real practical examples are implemented in both programming languages, always aiming at the same functionality. Finally, the implementations of both programming languages are examined and evaluated for memory consumption, functional safety and maintainability, and the measurements are compared. The comparison of the programming languages C and C++ represents the core of this work and the results should support the choice of the optimal programming language in upcoming embedded projects. This work states that C++ offers many abstraction possibilities without introducing an overhead on the target system. The measurements of the practical examples illustrate this statement with regard to flash memory consumption. Furthermore, this work shows that C++ can introduce an overhead, but that this can be justified depending on the use case. The additional abstraction levels of C++ can increase the compile time in large projects.
    Date of Award2025
    Original languageEnglish
    SupervisorMarkus Pfaff (Supervisor)

    Studyprogram

    • Embedded Systems Design

    Cite this

    '