Björn Tantau@swg-empire.de to Programmer Humor · 21 hours agoPretty straight forwardswg-empire.deimagemessage-square45fedilinkarrow-up1651arrow-down110file-text
arrow-up1641arrow-down1imagePretty straight forwardswg-empire.deBjörn Tantau@swg-empire.de to Programmer Humor · 21 hours agomessage-square45fedilinkfile-text
minus-squaretiredofsametab@fedia.iolinkfedilinkarrow-up17·19 hours agoNow call that C program from some other program in another language.
minus-squarexthexder@l.sw0.comlinkfedilinkarrow-up6·12 hours agoMay I present to you: https://github.com/mame/quine-relay
minus-squareJasonDJ@lemmy.ziplinkfedilinkarrow-up25·edit-219 hours 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-squareTraister101@lemmy.todaylinkfedilinkarrow-up1·13 hours 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-squarecalcopiritus@lemmy.worldlinkfedilinkarrow-up1·12 hours 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.
Now call that C program from some other program in another language.
May I present to you: https://github.com/mame/quine-relay
It’s… Beautiful.
with 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?""")
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)
unsafe 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.