Let rand = main as usize (2022)

The author shares a joke about Rust pointers on Twitter, focusing on ASLR (Address Space Layout Randomization) and the potential dangers of memory safety bugs. The program showcased in the joke demonstrates how the address of the main function can be observed and used as a random value, highlighting the limitations of using ASLR for random number generation. The author learns about Rust pointers, specifically raw function pointers, and expresses surprise at the compiler allowing casting between arbitrary raw pointer types outside of an unsafe block. The discussion touches on the ethical implications of potentially misleading code practices. The author acknowledges contributors and encourages feedback on Twitter.

https://codeandbitters.com/main-as-usize/

To top