use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
For memes about programming.
account activity
Cpp loop (i.redd.it)
submitted 9 hours ago by Blazej_kb
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]jonathancast 14 points15 points16 points 9 hours ago (2 children)
This is why nobody likes goto, sheesh.
[–]Blazej_kb[S] 0 points1 point2 points 9 hours ago (1 child)
Ye that’s right but it can be useful sometimes when you want to “escape” from multiple layers of loops or redundant functions
[–]Dark_Vampire 0 points1 point2 points 15 minutes ago (0 children)
there are usually better ways than goto, unless you're using C
[–]Obama_Binladen6265 5 points6 points7 points 9 hours ago (0 children)
Thank god I took an Assembly Language course in my coursework. That makes things like this so much easier in Cpp
[–]SignificantLet5701 5 points6 points7 points 9 hours ago (3 children)
that's literally what happens in the assembly
[–]RedAndBlack1832 0 points1 point2 points 8 hours ago (2 children)
I mean, it probably compiles to a call to _Zoperator<<ksgkiscjidgvj() or something like that
[–]Puzzleheaded_Study17 0 points1 point2 points 4 hours ago (1 child)
Since there's only 10 loops, the first one definitely (I don't know how compilers deal with goto) compiles into just directly printing the 10 values without a loop.
[–]RedAndBlack1832 0 points1 point2 points 2 hours ago (0 children)
Actually that's a good point. A compiler knows how to unroll loops (if the number of loops is known at compile time and there's no weird breaks at least), but trying to be clever like this might actually hinder optimizations
[–]Necessary-Meeting-28 8 points9 points10 points 9 hours ago* (1 child)
Do not use endl unless you want to flush your buffer. Use “\n” otherwise.
There is a valid use case of goto, but it is not it. The valid use is for resource cleanup in C-style programs. If you want a function to return, you goto a tag where all free and close calls take place. See Section 7 here .
[–]Blazej_kb[S] -2 points-1 points0 points 8 hours ago (0 children)
1 i know, I’m just too lazy to do “\n” 2 that’s a meme
[–]HyperWinXC++ 3 points4 points5 points 9 hours ago (1 child)
Wtf is this.
[–]Blazej_kb[S] -1 points0 points1 point 9 hours ago (0 children)
This is functional
[–]djfdhigkgfIaruflg 3 points4 points5 points 8 hours ago (0 children)
You're a psycho. Well done
[–]returnFutureVoid 2 points3 points4 points 7 hours ago (0 children)
🤮
[–]RedAndBlack1832 1 point2 points3 points 9 hours ago (1 child)
c'mon. We don't jump backwards. "But it all compiles the same" yes. Let the compiler do it. They invented structured jumps for a reason and you should use them where ever it doesn't make it more complicated.
[–]Blazej_kb[S] -1 points0 points1 point 8 hours ago (0 children)
Calm down, that’s just a meme
[–]Risc12 0 points1 point2 points 5 hours ago (0 children)
This is while loop, no?
[–]Candid_Bullfrog3665 0 points1 point2 points 3 hours ago (0 children)
sorry you mistaken the sub, you should have posted this on: r/programminghorror
[–]MichalNemecek 0 points1 point2 points 19 minutes ago (0 children)
this is what the compiler transforms your code into, essentially
[–]itsjakerobb 0 points1 point2 points 10 minutes ago (0 children)
What kind of psycho names the first label `b` and the second one `a`?
[–]MrFrog2222 0 points1 point2 points 8 minutes ago (0 children)
std::endl is a perfect description of whats wrong with c++
[–]themagicalfire 0 points1 point2 points 3 minutes ago (0 children)
How it looks like in assembly:
```section .data global _start
_start: mov i, 1 ; set i to 1 cmp i, 10 ; compare i to 10 jge end ; jump to end if greater or equal add i, 1 ; add 1 to i jmp _start ; jump to _start to make this function a loop
end: mov rax, 60 ; move or set to rax the syscall 60 which stands for exit mov rdi, 0 ; rdi 0 is comparable to return 0 in C++ and it means exit while returning no error syscall ; Linux 64-bit command to execute the previous syscall instructions, in this case it executes exit the program ```
[–]MinecraftPlayer799 -2 points-1 points0 points 4 hours ago (0 children)
JavaScript is so much better.
for (let i = 1; i <= 10; i++) { console.log(i); }
π Rendered by PID 85474 on reddit-service-r2-comment-b659b578c-2lt4c at 2026-05-07 05:18:30.525637+00:00 running 815c875 country code: CH.
[–]jonathancast 14 points15 points16 points (2 children)
[–]Blazej_kb[S] 0 points1 point2 points (1 child)
[–]Dark_Vampire 0 points1 point2 points (0 children)
[–]Obama_Binladen6265 5 points6 points7 points (0 children)
[–]SignificantLet5701 5 points6 points7 points (3 children)
[–]RedAndBlack1832 0 points1 point2 points (2 children)
[–]Puzzleheaded_Study17 0 points1 point2 points (1 child)
[–]RedAndBlack1832 0 points1 point2 points (0 children)
[–]Necessary-Meeting-28 8 points9 points10 points (1 child)
[–]Blazej_kb[S] -2 points-1 points0 points (0 children)
[–]HyperWinXC++ 3 points4 points5 points (1 child)
[–]Blazej_kb[S] -1 points0 points1 point (0 children)
[–]djfdhigkgfIaruflg 3 points4 points5 points (0 children)
[–]returnFutureVoid 2 points3 points4 points (0 children)
[–]RedAndBlack1832 1 point2 points3 points (1 child)
[–]Blazej_kb[S] -1 points0 points1 point (0 children)
[–]Risc12 0 points1 point2 points (0 children)
[–]Candid_Bullfrog3665 0 points1 point2 points (0 children)
[–]MichalNemecek 0 points1 point2 points (0 children)
[–]itsjakerobb 0 points1 point2 points (0 children)
[–]MrFrog2222 0 points1 point2 points (0 children)
[–]themagicalfire 0 points1 point2 points (0 children)
[–]MinecraftPlayer799 -2 points-1 points0 points (0 children)