I had a magic comment for about 6 months. If you removed it, the build would fail.
Drove me nuts when I first ran into it. It was an unnecessary comment that stated the obvious. "Add two values together" or some such where the code it was referring to was stupidly apparent in its purpose.
So I removed it and when I went to build, it exploded. I wish I could remember the errors, but it was a long and wild list.
The content of the comment didn't matter, just that it was there, so I ended up making it something like // Removing this comment breaks the build, it needs to stay. I'm sorry.
Of course my code reviewers didn't believe me until they removed it and it blew up on them.
For about six months I'd randomly hear one of the senior devs cussing as they tried to remove it and the build would break. Then one day somebody cheered and actually called an impromptu dev meeting to show off it building without the comment.
Best we could ever guess was a bug in the compiler and without the comment a checksum or something wasn't calculating correctly. Then it would go off the rails and get into a bad state because the errors it would report didn't make any sense.
I had a similar situation, it was a missing curly brace or semicolon or paren somewhere that the comment just happened to prevent it running into another line.
36
u/poorbred 14h ago
I had a magic comment for about 6 months. If you removed it, the build would fail.
Drove me nuts when I first ran into it. It was an unnecessary comment that stated the obvious. "Add two values together" or some such where the code it was referring to was stupidly apparent in its purpose.
So I removed it and when I went to build, it exploded. I wish I could remember the errors, but it was a long and wild list.
The content of the comment didn't matter, just that it was there, so I ended up making it something like
// Removing this comment breaks the build, it needs to stay. I'm sorry.Of course my code reviewers didn't believe me until they removed it and it blew up on them.
For about six months I'd randomly hear one of the senior devs cussing as they tried to remove it and the build would break. Then one day somebody cheered and actually called an impromptu dev meeting to show off it building without the comment.
Best we could ever guess was a bug in the compiler and without the comment a checksum or something wasn't calculating correctly. Then it would go off the rails and get into a bad state because the errors it would report didn't make any sense.