Question.7
A developer constructs a UART driver directly at a hardware register address:
UART_Driver* uart1 = new (reinterpret_cast<void*>(0x40005000)) UART_Driver();
Is this valid?
Select Answer
No -- you cannot construct at hardware addresses
Yes -- this maps the C++ object onto the hardware register block, allowing method calls to directly access registers (with important caveats)
Yes -- but the constructor must not write to members
No -- reinterpret_cast is not allowed with placement new
reinterpret_cast