182. Static Memory-ii

Question.4

A developer constructs a C++ object in static memory:

#include <new>

alignas(UART) static uint8_t uart_mem[sizeof(UART)];

void init() {
   UART* u = new (uart_mem) UART(9600);
   u->send(0x55);
}

What is the advantage over new UART(9600)?

Need Help? Refer to the Quick Guide below

Select Answer

Restart quiz!