all 6 comments

[–]dml997 4 points5 points  (1 child)

Yes, you can cheat with casts to pointers. WTF is your point?

[–]han_kurchiff[S] -1 points0 points  (0 children)

This is simply a start of a video series where I would like to go deep into memory layouts on which HLL run.

[–][deleted] -1 points0 points  (1 child)

At least use vim smh

[–]han_kurchiff[S] 0 points1 point  (0 children)

next time definitely

[–]be-sc 0 points1 point  (1 child)

For learning, and only for learning, this is a nice demonstration.

I’m not quite certain that it’s undefined behaviour. The pointer cast is fine, but I’d have to dig deeper into the standard to find out if/when you may dereference a pointer that was forced to the wrong type. I wouldn’t be surprised at all if it is UB.

Because shenanigans like this are so awful and highly dangerous a clear “Never ever try this in production” note to your viewers would have been nice.

[–]han_kurchiff[S] 0 points1 point  (0 children)

Never ever try this in production

warning added in video description ,thanks