552
Pointers explained: (thelemmy.club)
you are viewing a single comment's thread
view the rest of the comments
[-] Sylvartas@lemmy.dbzer0.com 10 points 2 months ago* (last edited 2 months ago)

Most of the time you pass by reference for more outputs, or by const ref to avoid copying a big-ass data structure (which is not always straightforward, with structures smaller than a pointer, which are pretty big in 64 bits architecture, you lose more to the ref overhead than to the copy IIRC)

[-] DahGangalang@infosec.pub 4 points 2 months ago

Another reason I commonly see: to change the structure / "main pointer" to a data structure (esp during freeing and cleanup).

this post was submitted on 08 Jun 2026
552 points (94.2% liked)

Programmer Humor

32702 readers
1369 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 3 years ago
MODERATORS