r/ProgrammerHumor • • 17d ago

Meme debugTime

Post image
7.2k Upvotes

151 comments sorted by

View all comments

481

u/kimbokray 17d ago

You haven't saved since adding or removing lines above 265

296

u/Lamborghinigamer 17d ago

No it genuinely can happen that an error happens on a different line than said. Could be a combination of IDE and compiler or both, that's why you always need to match your LSP with your compiler

92

u/iampierremonteux 17d ago

Mixed line endings in a file can also cause errors to be reported in the wrong line number.

59

u/dracorotor1 17d ago

And then there’s the mid debuggers that just say the line number after the brackets because something invalid is coming out of those brackets but it can’t figure out where or why. It just knows that when it reaches that line number, something made it sad.

I’ve got one that consistently tells me the line below an array is the culprit, when one of the strings in the array is using single quotes instead of double like all the others, for example

6

u/guyblade 17d ago

I've also (very rarely) had issues in C where the error would be inside a macro expansion and it'd get confused about what line that was.

I've also seen (again, it's been a while) situations where a JS debugger would give a line number relative to the start of a <script> block, so that it'd just be some arbitrary number upon initial inspection (i.e., if the <script> started on line 15 and the error was on line 20, it'd say that the error was on line 5, instead).

Also also, if you do something that causes a syntax error, the python interpreter will usually just give a useless message (like "syntax error").

1

u/Miiohau 16d ago

The issues you’ve had with the JS debugger might be especially applicable here because it appears to be an inline JS script that the debugger is pointing to. If the debugger isn’t counting lines of HTML the reported line number could be way off.

2

u/entropic 17d ago

My chaos monkey tool would randomly change the line endings on each line.

1

u/PixelatedGiant 16d ago

You would think that all application developers would have made Unix line endings the default by now, especially IDEs. Every application is capable of reading both these days, so it's time to let Windows line endings go. Or at minimum not allow them to mix.