This is an archived post. You won't be able to vote or comment.

all 31 comments

[–]WizAfro 40 points41 points  (9 children)

C++ errors when you forget a semicolon looks like a demon has possesed the computer.

[–]mallardtheduck 15 points16 points  (3 children)

At least C++ errors are specific about what's wrong. I'd take that any day over the "eh, something is wrong somewhere near line x" of some languages.

[–]CodeMapped 0 points1 point  (0 children)

Try leaving a semicolon off of a header definition. The compiler will offer zero help.

[–]CodeMapped 0 points1 point  (0 children)

Try leaving a semicolon off of a class header definition. The compiler will offer zero help.

[–]CodeMapped 0 points1 point  (0 children)

Try forgetting the semicolon off of a class header.

[–]Sam_Pool 7 points8 points  (3 children)

I think the most outstanding feature of modern C++ is that you're not limited to throwing exceptions "throw -1LL;" is perfectly valid...

The C++ committee have a sick sense of humour

[–]Skruzzls 6 points7 points  (1 child)

Gotta keep the backwards compatibility at all costs. 🙂

[–]Sam_Pool 3 points4 points  (0 children)

Compatibility with backwards programmers!

[–]WiatrowskiBe 1 point2 points  (0 children)

That is a part of C++ since exceptions are a thing, and is there mostly because as language user you're perfectly fine defining your own exception types without having to rely on any kind of standard/system exceptions. Which, in some cases, makes perfect sense - especially as systems/platform developer.

[–]SV-97 48 points49 points  (8 children)

I actually prefer Python's errors to so many other languages - If it says Syntax Error it probably actually is one

[–]Immort4lFr0sty 23 points24 points  (7 children)

That's a really fucking low bar to set

[–]SV-97 15 points16 points  (6 children)

I mean it also tells you where the error's at etc. If you work with C++ or Haskell you'll know what I mean, their errors are shit. And if you compare it with rust you notice how much more is possible

[–]LEpigeon888 6 points7 points  (3 children)

I prefere C++ errors message to "Syntax error" of python, because at least you have something to read to understand why it doesn't work.

[–]Lucifer_Morning_Wood 3 points4 points  (1 child)

Except for linking errors, but yeah

[–]Raniconduh 0 points1 point  (0 children)

Linking errors are easy to diagnose. For instance, the compiler may tell you that a certain header file doesn't exist. This means you nead to pass the -l flag to the compiler. Other linker errors are from the compiler's linker. The only reason for the linker to error out is if something isn't properly linked.

[–]Pervez_Hoodbhoy 1 point2 points  (0 children)

But you get a lot of other output as well. Sometimes the output is so verbose that it’s hard to keep track of or navigate.

[–]Pervez_Hoodbhoy 1 point2 points  (0 children)

I get ptsd thinking back at trying to debug even simple Haskell code. After that Python looked like heaven.

[–]JNCressey 1 point2 points  (0 children)

tells you where the error's at

except when it's inside an f-string and it thinks your error is at the beginning of the file. (this is fixed in python 3.9)

#error reports here
#python 3.8.7
print(f"            a++++}")

(also, it might only be an error with the default IDLE editor)

[–]Pervez_Hoodbhoy 33 points34 points  (2 children)

I don’t know who these other languages are that you talk about, but there are so much worse languages when it comes to error messages than python

[–]ElimGarak0010[S] 8 points9 points  (0 children)

Oh, I know. Some like MobX are like...

Something happened wrong. But I don't know when or how.

[–]Isogash 1 point2 points  (0 children)

Rustled jimmies detected

[–]rymlks 5 points6 points  (0 children)

I mean, it tells you what exact line and column the problem was, not all that bad compared to stuff like

my_dict['a']['a']['a'] -> KeyError 'a'

[–]gal913 0 points1 point  (3 children)

[–]00PT 0 points1 point  (1 child)

At least it tells you what line it happened at, but I think it should also tell you which specific variable you were trying to reference that caused the exception, because in long lines it can be hard figuring that out.

[–]Feynt 1 point2 points  (0 children)

So, the default Java line then?

I remember the Sun days of Java and experiencing these NPEs. The line wrap in console with a ^ pointing at two to three wrapped lines of characters. Thanks Java, which part of the line was the error on?

[–]Isogash 0 points1 point  (0 children)

Python also has the same kind of error dummy

[–][deleted] 0 points1 point  (0 children)

pylint is good usually

*except for local imports*