724
you are viewing a single comment's thread
view the rest of the comments
[-] tiredofsametab@fedia.io 18 points 4 months ago

Now call that C program from some other program in another language.

[-] JasonDJ@lemmy.zip 26 points 4 months ago* (last edited 4 months ago)
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?""")
[-] bjoern_tantau@swg-empire.de 23 points 4 months ago
[-] tiredofsametab@fedia.io 14 points 4 months ago
[-] Traister101@lemmy.today 1 points 4 months ago

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)

[-] calcopiritus@lemmy.world 1 points 4 months ago
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.

this post was submitted on 12 Mar 2025
724 points (98.4% liked)

Programmer Humor

25513 readers
1897 users here now

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

founded 2 years ago
MODERATORS