Question.7
A developer uses unique_ptr for a small local buffer:
void process_byte(uint8_t b) { auto buf = std::make_unique<uint8_t>(b); send(buf.get()); }
Is this good practice?
Select Answer
Yes -- all pointers should be smart pointers
No -- a single byte does not need heap allocation; use a local stack variable instead: uint8_t buf = b;
Yes -- unique_ptr prevents leaks
No -- unique_ptr cannot hold uint8_t