r/ProgrammerHumor • • Nov 25 '22

Meme Coding strategies

Post image
52.2k Upvotes

385 comments sorted by

View all comments

Show parent comments

575

u/[deleted] Nov 25 '22

I think it was CodeWarrior for the PS2 or PSX (definitely a playstation compiler around the year 2000) we were having issues with byte alignments. Eventually we discovered that the tokenizer was including commented out code which was then used as a part of padding/alignment and you could break the ABI by changing comments. Those comments were locked into place, even after they were no longer relevant and flat out wrong. It was horrible.

95

u/qoning Nov 25 '22

Tbh the obvious solution there is to write a precompiler to remove all comments.

But I bet the dude who discovered the source of the bugs had an awesome day. I would LOVE to be there at that minute.

1

u/skeleton-is-alive Nov 25 '22

Now you’ll be running into cool new issues where your buggy precompiler removed the wrong stuff or failed to remove a special case :)

1

u/qoning Nov 25 '22

Thankfully parsing out comments is the one thing you can sanely do with C++ code.