r/badcode • • Jun 09 '20

c++ EA published their Command&Conquer Code on github. This is my favorite part so far.

Post image
1.6k Upvotes

36 comments sorted by

View all comments

36

u/Achereto Jun 09 '20

You can find that piece of code here: https://github.com/electronicarts/CnC_Remastered_Collection/blob/master/REDALERT/CONNECT.CPP#L98

Why is it bad?

  1. The comment adds nothing to your code that isn't already explained by the code.

  2. The name "magic number" is a very bad choice since it's not explanatory.

  3. lots of visual noise around the code.

16

u/microwavedHamster Jun 09 '20

Serious question. Have you ever worked as a software engineer in the video game industry?

4

u/Achereto Jun 09 '20

No. I am a Software Engineer for ~5 years now, but I haven't worked in the game industry yet.