Skip to content

C++ Standard Environment

lbuild module: modm:stdc++

Refines the C++ language to make it easier to use on embedded targets. Depending on the module options, the compiler options are appended with either:

  • -fno-exceptions: no C++ exceptions.
  • -fno-rtti: no C++ run-time type information.
  • -fno-threadsafe-statics: no protection of static variable initialization.

or:

  • -fexceptions: with C++ exceptions.
  • -frtti: with C++ run-time type information.

The std::atomic interface is implemented for the AVR and Cortex-M devices.

AVR

A partial port of GCC libstdc++ is provided: See https://github.com/modm-io/avr-libstdcpp.

Options

assert_on_exception

Assert on exception in stdlib. Set to False to save flash.

This option is only available for avr.

Default: yes
Inputs: [yes, no]

exceptions

C++ Exceptions

Enables the full use of C++ exception handling.

Check your code size

The inclusion of the stack unwind tables will increase your code size quite a bit. Check whether your target has enough memory for this!

This option is only available for rp, sam, stm32.

Default: no
Inputs: [yes, no]

rtti

C++ Runtime Type Information

Enables the full use of C++ runtime type information.

Check your code size

The inclusion of the RTTI information will increase your code size quite a bit. Check whether your target has enough memory for this!

This option is only available for rp, sam, stm32.

Default: no
Inputs: [yes, no]

safe_statics

C++ Safe Statics Initialization

Enables safe initialization of statics inside functions and interrupts. In case of recursive initialization the debug assertion stat.rec is raised.

Further reading on this topic:

This option is only available for avr, rp, sam, stm32.

Default: yes
Inputs: [yes, no]

Dependencies

modm:stdc++ modm_stdc++ modm: stdc++ modm_architecture_assert modm: architecture: assert modm_stdc++->modm_architecture_assert modm_architecture_atomic modm: architecture: atomic modm_stdc++->modm_architecture_atomic modm_stdc modm: stdc modm_stdc++->modm_stdc