µOS++ IIIe Reference 7.0.0
The third edition of µOS++, a POSIX inspired open source framework, written in C++
Loading...
Searching...
No Matches
std Namespace Reference

Standard std namespace. More...

Functions

new_handler get_new_handler () noexcept
 Get the current handler.
 
new_handler set_new_handler (new_handler handler) noexcept
 Establishes the function designated by handler as the current new_handler.
 

Variables

const nothrow_t nothrow = nothrow_t{}
 

Detailed Description

When building µOS++ applications for embedded targets, in addition to the os::estd namespace, the standard thread classes are also defined in the std namespace, so that applications explicitly using the std:: prefix need minimal changes to build.

The only non-standard feature is the need to prefix the included headers with cmsis-plus/std/, for example <cmsis-plus/std/thread>.

Function Documentation

◆ get_new_handler()

new_handler std::get_new_handler ( )
noexcept
Parameters
None.
Returns
Pointer to user function, or nullptr if not set.

The initial new_handler is a null pointer.

Definition at line 101 of file new.cpp.

102 {
103 return new_handler_;
104 }
std::new_handler new_handler_
The current new handler.
Definition new.cpp:53

◆ set_new_handler()

new_handler std::set_new_handler ( new_handler  handler)
noexcept
Parameters
handlerPointer to user function.
Returns
The previous handler.

This handler is invoked when the standard operator new() detect an out of memory condition, to give a chance to the application process it properly. If the application can arrange for more memory to be used for allocation, this function should return and the allocation process is retried. If not, this function should gracefully shut down and restart.

The initial new_handler is a null pointer.

Definition at line 79 of file new.cpp.

80 {
81 trace::printf ("std::%s(%p) \n", __func__, handler);
82
83 new_handler prev_handler;
84
85 prev_handler = new_handler_;
86 new_handler_ = handler;
87
88 return prev_handler;
89 }
int printf(const char *format,...)
Write a formatted string to the trace device.
Definition trace.cpp:59

References os::trace::printf().

Variable Documentation

◆ nothrow

const nothrow_t std::nothrow = nothrow_t{}

Definition at line 60 of file new.cpp.