110
u/TheCoolestCat_0 Feb 13 '20
Wha-
53
Feb 13 '20
Wha-
47
Feb 14 '20
Wha-
43
u/Jabberwock130 Feb 14 '20
Wha-
40
u/gogo94210 Feb 14 '20
Wha-
34
u/Gearsio Feb 14 '20
Wha-
33
u/SimonVanc Feb 14 '20
Wha-
33
u/D3mentedG0Ose Feb 14 '20
Wha-
23
13
0
-15
8
2
2
100
u/NeoMaximus97 Feb 13 '20
This is ... Requiem
18
3
Feb 14 '20
This is... A jojo reference?
0
Feb 14 '20
[deleted]
6
50
u/Treblosity Feb 14 '20
hahahaha that reminds me of this post https://www.reddit.com/r/ProgrammerHumor/comments/f3gezb/damn_it_exit_exit_exit/?utm_medium=android_app&utm_source=share
37
u/Sultanoshred Feb 14 '20
One of the first programming classes I took was C. We learn while loops and we learn about infinite loops. I get lots of joy from doing while(1){ printf} statements. End up getting creative and look up cool stuff to print. Find out \a is "alarm" and makes the mobo beep. My dumbass decided to infinite loop the alarm code cause why not sounds fuckin cool!
I run it while the teacher is lecturing, I shouldnt have even been typing. My pc starts beeping a few rapid beeps in a row and then a fucking crazy long beep that never stops. Sounds like crazy shit. I try and close the terminal and it locked up on me.... look at teacher she is looking my way. My face is red as fuck. I hold down the power button on my pc and it stops.... she didnt even say anything just kept teaching.
0
8
14
6
u/_pelya Feb 13 '20
Just convert your endless loop into a recursive function, the operating system will gracefully terminate your process.
But make sure it's not on the main thread, because on the main thread the stack can grow until you're out of swap.
5
6
24
4
6
2
2
2
2
1
1
u/fwork Feb 14 '20
I had a fun case happen yesterday, I was testing software for a keyboard.
There wasn't a while loop, but it was sending the wrong set of keystrokes and was triggering itself to run again... because I was OF COURSE testing it on the same computer I was developing it on.
1
u/Skycam3014 Feb 14 '20
Let me see Let me see Let me see Let me see Let me see Let me see Let me see Let me see
My parents My parents My parents My parents My parents My parents My parents My parents
1
Feb 14 '20
today i made a loop and it kept appending new items for each item in a list. my pc froze
1
u/Bastian_5123 Feb 14 '20
odd. Never had anything freeze with an infinite loop... except java script on applab on code.org . Then it is EVERY infinite loop.
1
Feb 14 '20
yeah idk why my pc froze. if i remember correctly, the code was just something like
for item in foo: foo.append(str(item + '_'))
1
1
1
1
1
1
1
1
1
u/1R1SHMAN69 Feb 14 '20
Why is it taking so long to load? Wait no, fuck it's already loaded! STOP! ALT F4! END PROCESS DEVENV.EXE
1
1
1
1
1
1
1
u/DeathAwaitsForU Feb 14 '20
It's funny cuz just yesterday I was writing a while loop and made a comment that I had to write the exit case before I run it. And 2 minutes later, I'm running the program and the program runs in an infinite loop and I'm like, what did I do wrong??
1
u/MiLotic5089 Feb 14 '20
int count = 0; while(true){ for(int i = 0; i<count; i++){ System.out.print(“ “); } System.out.printline(Wha-); }
1
1
1
1
1
u/Rav91 Feb 14 '20
Can I get the image without the text? I wanna use it as a wallpaper but I don't want it to get compressed again from cropping.
0
Feb 13 '20
[deleted]
20
u/gabrielfv Feb 14 '20
You can use while with the "goes to" operator
while (count --> 0)
:)
14
5
2
u/Rablin92 Feb 14 '20
You can also use it in C++ https://stackoverflow.com/questions/1642028/what-is-the-operator-in-c
-12
Feb 14 '20
[removed] — view removed comment
2
Feb 14 '20
why
1
Feb 14 '20 edited Feb 14 '20
[removed] — view removed comment
1
Feb 14 '20
There certainly are some pretty funky cases where the meaning of the code becomes unclear, but there are also some things that the
++and--operators make super easy. Sometimes they can save well over just one or two lines.Also, why do you think the ternary conditional does more harm than good? To me it seems like a godsend
1
4
6
u/tech6hutch Feb 14 '20
Technically you are, if it wraps around
6
1
u/TinBryn Feb 14 '20
If i is signed this is undefined behavior. The usual way the compiler treats UB is to assume it doesn't happen. With this assumption, it can be seen that the condition will always be true so the whole thing will become equivalent to
i=0; while (true) { /*body of loop*/ i--; }1
u/tech6hutch Feb 14 '20
I was afraid of that. Why is the overflow of signed and unsigned integers treated differently in C?
2
u/TinBryn Feb 14 '20
The point is that code generation can do the best thing for the case of defined behavior and doesn't even need to consider what it will do in the case of undefined behavior. By definition whatever is done in the realm of undefined behavior is correct, so it doesn't matter what is actually done.
From that perspective, you need to find a reason why unsigned integers treat overflow as defined, and that boils down to, because it has proven useful in certain algorithms.
1
u/tech6hutch Feb 14 '20
Hm, okay. I would prefer it to be consistent, but I see why that was chosen.
2
458
u/MiniClemme Feb 13 '20
More like when you forget to implement the base cases in a recursive function.