Why is everyone downvoting this? Isn't this a joke like "my boss said not to put while true so I put this and am now explaining to him that it doesn't count"
Clean code is for long term support, so I'm not gonna write anything more refined than the first thing that comes into my mind for this 2 day jubilee!!!
as far as i know this kind of conditioning is used where there is a chance for compiling the code for multiple target platforms (with different compilers f.e.). false is 0, but true may can be compiler dependent (i've been told :D )
at least we are using ==!false instead of ==true, because 1 code may be compiled for several and different controllers with different compilers.
Principle engineer got on me about using print stack trace to system out in Java. So I used a logger to do it instead. For some reason that was better.
338
u/Mulligan315 Dec 30 '21
When you’ve been told that while(true) is bad design.
100
u/[deleted] Dec 30 '21
Not gonna lie, I've written something just like this before... in the middle of the night of a weekend gamejam.
62
u/pine_ary Dec 30 '21
It‘s true
52
u/Slazy_ Dec 30 '21
This is what a beginmer writes when they are showing someone code and want to make it look confusing so that they look smart.
35
u/4sent4 Dec 30 '21
Well, it's not false
20
u/vlr_04 shameless Dec 30 '21
Don't use
!false, use1==1instead, it is two characters shorter!18
u/rowerdude Dec 30 '21
When checkstyle prevents while(true)…
16
u/Toxic-Sky Dec 30 '21
23
u/[deleted] Dec 30 '21
r/technicallythetruth
9
u/Budgiebrain222 Dec 30 '21
Well it works right?
11
u/Ilaught Dec 30 '21
Imagine not using for(;;) in 2021. SMH my head.
5
u/missingdays Dec 30 '21
Then
false = true
Inside the while body
3
u/Lofaszmaxi Dec 30 '21
as far as i know this kind of conditioning is used where there is a chance for compiling the code for multiple target platforms (with different compilers f.e.). false is 0, but true may can be compiler dependent (i've been told :D )
at least we are using ==!false instead of ==true, because 1 code may be compiled for several and different controllers with different compilers.
2
u/tribak Dec 30 '21
!!true
2
u/[deleted] Dec 30 '21
while(!0) {}
2
u/PacoWaco88 Dec 30 '21
Principle engineer got on me about using print stack trace to system out in Java. So I used a logger to do it instead. For some reason that was better.
2
u/Efarm12 Dec 31 '21
I have put while (1!=2) {...} before... some don't like it.
2
u/AchillesPrime Dec 31 '21
Only if false is a variable that’s value is true :)
1
u/[deleted] Dec 30 '21
Funny though
1
u/Routine-Way Dec 30 '21
bad != !good
1
u/bistr-o-math Dec 30 '21
while([]){…} // not Java though1
u/Masterpommel Dec 31 '21
I mean its a nice little easteregg I would put in my code. Isnt breaking something so...
1
u/toxicbzb Dec 31 '21
While (!(!true))
1
u/Lkj509 Dec 31 '21
When your professors deducts marks for while (true)
1
u/Kittenji Dec 31 '21
while ({true () {return !void 0}}.true()) {...}1
u/wolderado Dec 31 '21
This feels passive-aggressive
1
u/[deleted] Apr 02 '22
no