pitrou commented on PR #35565:
URL: https://github.com/apache/arrow/pull/35565#issuecomment-1551566178

   > e.g. casting uint8_t* to uint32_t* is only safe if the buffer has 4-byte 
alignment
   
   I'm not sure where you got that from the C++ spec?
   
   If I try to understand 
https://en.cppreference.com/w/cpp/language/reinterpret_cast (especially the 
"Type Aliasing" paragraph), it seems only `uint32_t*` to `uint8_t*` is 
spec-compliant, not the other way round.
   
   > Whenever an attempt is made to read or modify the stored value of an 
object of type DynamicType through a glvalue of type AliasedType, the behavior 
is undefined unless one of the following is true:
   
   >  * AliasedType and DynamicType are similar.
   >  * AliasedType is the (possibly 
[cv](https://en.cppreference.com/w/cpp/language/cv)-qualified) signed or 
unsigned variant of DynamicType.
   >  * AliasedType is 
[std::byte](https://en.cppreference.com/w/cpp/types/byte), (since C++17) char, 
or unsigned char: this permits examination of the [object 
representation](https://en.cppreference.com/w/cpp/language/object#Object_representation_and_value_representation)
 of any object as an array of bytes.


-- 
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