Low-Cost Deterministic C++ Exceptions for Embedded Systems

James Renwick, Tom Spink, Bjoern Franke

Research output: Chapter in Book/Report/Conference proceedingConference contribution

Abstract / Description of output

The C++ programming language offers a strong exception mechanism for error handling at the language level, improving code readability, safety, and maintainability. However, current C++ implementations are targeted at general-purpose systems, often sacrificing code size, memory usage, and resource determinism for the sake of performance. This makes C++ exceptions a particularly undesirable choice for embedded applications where code size and resource determinism are often paramount. Consequently, embedded coding guidelines either forbid the use of C++ exceptions, or embedded C++ tool chains omit exception handling altogether. In this paper, we develop a novel implementation of C++ exceptions that eliminates these issues, and enables their use for embedded systems. We combine existing stack unwinding techniques with a new approach to memory management and run-time type information (RTTI). In doing so we create a compliant C++ exception handling implementation, providing bounded runtime and memory usage, while reducing code size requirements by up to 82%, and incurring only a minimal runtime overhead for the common case of no exceptions.
Original languageEnglish
Title of host publicationProceedings of the 28th International Conference on Compiler Construction
Place of PublicationWashington, DC, USA
Number of pages11
ISBN (Electronic)978-1-4503-6277-1
Publication statusPublished - 16 Feb 2019
Event28th International Conference on Compiler Construction - Washington D.C., United States
Duration: 16 Feb 201917 Feb 2019


Conference28th International Conference on Compiler Construction
Abbreviated titleCC 2019
Country/TerritoryUnited States
CityWashington D.C.
Internet address

Keywords / Materials (for Non-textual outputs)

  • C++
  • exceptions
  • error handling
  • software performance
  • Language features


Dive into the research topics of 'Low-Cost Deterministic C++ Exceptions for Embedded Systems'. Together they form a unique fingerprint.

Cite this