2 ms·
Returning a pointer to a local variable is convenient, but can be a source of hidden allocations. It's best to treat each struct as a "value" or "pointer" type
by assbuttbuttass 4y ago
Returning a pointer to a local variable is convenient, but can be a source of hidden allocations.
It's best to treat each struct as a "value" or "pointer" type, and use one or the other consistently for each type. This mostly avoids the need to use & in the first place