this post was submitted on 12 Mar 2025
729 points (100.0% liked)

Programmer Humor

24653 readers
107 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
you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 19 points 3 months ago (3 children)

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

[–] [email protected] 25 points 3 months ago* (last edited 3 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?""")
[–] [email protected] 23 points 3 months ago (1 children)
[–] [email protected] 15 points 3 months ago (1 children)
[–] [email protected] 1 points 3 months ago (1 children)

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)

[–] [email protected] 1 points 3 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.

[–] [email protected] 7 points 3 months ago (1 children)
[–] [email protected] 2 points 3 months ago

It's..... Beautiful.