felipecrv commented on issue #35581:
URL: https://github.com/apache/arrow/issues/35581#issuecomment-1553330957

   ```cpp
   ArraySpan span;
   span.FillFromScalar(scalar);
   
   UseSpan(span); // Fine; the original span is still alive.
   
   return span; // Undefined Behavior; the returned copy views
                // a stack variable whose lifetime has ended.
    ```
    
    Due to RVO, the returned `ArraySpan` is constructed at the caller's stack 
and this is not biting us, I guess. I think this is a matter of always using 
destination-passing style when dealing with `ArraySpan` and never copying or 
moving it.
    
    Copy and Move constructors haven't been `= delete;`d in the class, I wonder 
if they could be still. I think we are allowed to do so as it's laveled 
`EXPERIMENTAL`.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to