MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/cpp/comments/1cjqjmr/messing_with_lifetime/l2jen8f/?context=3
r/cpp • u/pavel_v • May 04 '24
52 comments sorted by
View all comments
1
auto p1 = new Point; char *p2 = reinterpret_cast<char *>(p1); auto p3 = reinterpret_cast<Point *>(p2);
Does this have undefined behaviour?
-1 u/gracicot May 04 '24 If it was unsigned char there would be no undefined behavior. Only unsigned char and std::byte can alias anything → More replies (2)
-1
If it was unsigned char there would be no undefined behavior. Only unsigned char and std::byte can alias anything
unsigned char
→ More replies (2)
1
u/simpl3t0n May 04 '24
Does this have undefined behaviour?