Bad code examples


(𝒦𝒾𝓃𝑔 π‘œπ’» π’―π’½π’Ύπ“ƒπ‘”π“ˆ) #22

i second this


(𝑻𝒉𝒆 π‘±π’π’π’π’š π‘¬π’Žπ’‘π’†π’“π’π’“ 𝒐𝒇 𝑺𝒆𝒂𝒇𝒐𝒐𝒅) #23

I third this
threads die for a reason


#24

So… When will you be joining the programming team?

This was an offtopic post that didn’t add to the conversation. Whereas @DPHkraken showed how to properly post in the right thread when new things to discuss materialize.


#25

I just had to do some really nasty code to get visual studio (thanks, microsoft) to compile Leviathan.

Previous version (that GCC, a good compiler, compiles without issues):

auto guard = (Leviathan::Locker::Object(this));

New version (it has a bit different approach because the previous approach just didn’t work with vs), this is also a good example how complex C++ template magic can get:

Leviathan::LockTypeResolver<std::remove_reference_t<decltype(
     Leviathan::Locker::AcessLock(this))>>::LType
     guard(Leviathan::Locker::AcessLock(this));

(𝒦𝒾𝓃𝑔 π‘œπ’» π’―π’½π’Ύπ“ƒπ‘”π“ˆ) #26

Might as well contribute

Bad coding example: all of YandereSim


#27

I’ve heard many people say that the dev is incompetent and thus the code is probably terrible (and part of the reason why it is taking so long). But has anyone actually seen the code in order to determine if it is actually terrible?

Philosophical question: does bad code exist if there is no one to see it?


(𝑻𝒉𝒆 π‘±π’π’π’π’š π‘¬π’Žπ’‘π’†π’“π’π’“ 𝒐𝒇 𝑺𝒆𝒂𝒇𝒐𝒐𝒅) #28

depends on how well the game runs. And if it runs well, does it matter?


(𝒦𝒾𝓃𝑔 π‘œπ’» π’―π’½π’Ύπ“ƒπ‘”π“ˆ) #29

Multiple people have said that they or a friend of theirs has looked at the code before.

Also, the game is prone to have many bugs and gigantic framerate drops, even though the game isnt that graphically demanding.


(Ξ”Ρ„ - Delta Phi) #30

More bad code: I don’t know how to turn a string into a number, so instead I have to turn the string into a color and take the red value. What in the even.
string.ToColor(args[1].." 0 0 0" ).r +1


#31

Here is an example what happens when you write bad code:


(𝒦𝒾𝓃𝑔 π‘œπ’» π’―π’½π’Ύπ“ƒπ‘”π“ˆ) #32

Must be some brutal code to put him through so much agony.