this post was submitted on 17 Dec 2025
515 points (96.2% liked)
Programmer Humor
28424 readers
1463 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
- Keep content in english
- No advertisements
- Posts must be related to programming or programmer topics
founded 2 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
So that's why people like C-style return types. That actually makes a lot of sense. I do too now.
To be honest, I think, they both have their place. In Rust, you typically wouldn't return just a
bool, but rather the element that you removed, so like this:And then with such a more complex return-type, C-style means that you can't see the function name right away:
I also really don't think, it's a big deal to move your eyes to the
->...Amusingly, modern C++ allows you to copy the rust signature nearly 1:1:
Huh, did that emerge out of unrelated design decisions or did they just figure

I believe that it is useful in a few places. cppreference.com mentions templates as one case:
The syntax also matches that of lambdas, though I'm not sure that adding another way of specifying regular functions actually makes the language more consistent, since most code still uses the old style.
Additionally, the scope of the return type matches the function meaning that you can do
instead of
which is kinda nice
Very interesting, thanks! 🙂