this post was submitted on 11 Feb 2025
202 points (94.7% liked)
Programmer Humor
20429 readers
2666 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
Should return 0;.
>What is C++? A miserable huge pile of "should"s
Love me some Castlevania++
should have a space after „>” and two new lines after „?”.
I guess markdown is miserable as well.
not being able to master markdown might hint at why the commenter is struggling with C++
Hey now, markdown serves it's purpose. It's not great, but as a web dev, I don't want people expecting full WYSIWYG editors in every website cause fuck that!
Still love it tho. You can make it whatever you want!
Not needed, main in C++ implicitly returns 0 if there is no return
Should ≠ Needs to
You can do it, and it will work, but it's unclean and not best-practice. I wouldn't be surprised if it's undefined behaviour.
Just to clarify. It is defined behavior - there's plenty of undefined behavior in C but that ain't one of them.
Interesting feature, I had no idea. I just verified this with gcc and indeed the return register is always set to 0 before returning unless otherwise specified.
spoiler
produces:
produces:
It likely does, at some point within the ellipsis.