this post was submitted on 31 Jan 2026
281 points (99.0% liked)

Programmer Humor

30262 readers
2313 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
[–] Ephera@lemmy.ml 46 points 1 month ago (5 children)

The rule of thumb I always tell people is that they should generally put owned data into struct fields and references into function parameters.

[–] harrowhawk@lemmy.sdf.org 5 points 1 month ago

I like this rule of thumb and it goes nicely with the “if you have more than 3 arguments to a function, consider making a struct to pass the arguments in” rule of thumb because

You can have the struct use a named lifetime (or several) for the different parameters so it doesn’t own them!

Best of both worlds.

load more comments (4 replies)