Björn Tantau to Programmer Humor@programming.dev • 4 days agoPretty straight forwardswg-empire.deimagemessage-square47fedilinkarrow-up1712arrow-down112
arrow-up1700arrow-down1imagePretty straight forwardswg-empire.deBjörn Tantau to Programmer Humor@programming.dev • 4 days agomessage-square47fedilink
minus-squaretiredofsametablinkfedilink19•4 days agoNow call that C program from some other program in another language.
minus-square@JasonDJ@lemmy.ziplinkfedilink27•edit-24 days agowith open('program.c', 'w') as f: f.write( """I'm not actually going to copy down the program... But you get the idea of the joke. Right?""")
minus-squareTraister101linkfedilink1•4 days agoAh yes now I can… dereference a raw pointer (yes that’s essentially the only thing unsafe rust actually enables you to do, it doesn’t disable the borrow checker or anything else, it just allows you to play with pointers)
minus-square@calcopiritus@lemmy.worldlinkfedilink1•4 days agounsafe fn<'a, T>(p: &'a T) -> &'static mut T { p as *cons T as *mut T as &'static mut T } It is a bit more than just dereferencing raw pointers.
minus-square@xthexder@l.sw0.comlinkfedilink7•4 days agoMay I present to you: https://github.com/mame/quine-relay
Now call that C program from some other program in another language.
Rust, to make it safe.
step 1:
unsafe fn()
…Ah yes now I can… dereference a raw pointer (yes that’s essentially the only thing unsafe rust actually enables you to do, it doesn’t disable the borrow checker or anything else, it just allows you to play with pointers)
It is a bit more than just dereferencing raw pointers.
May I present to you: https://github.com/mame/quine-relay
It’s… Beautiful.