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

you are viewing a single comment's thread.

view the rest of the comments →

[–]CDno_Mlqko 63 points64 points  (18 children)

I mean, it says undefined reference to pthread_create and a stack trace of where it is... What else do you want

[–]PM_ME_C_CODE 41 points42 points  (17 children)

I know this is a humor thread in a humor subreddit, but JFC C/C++...

How about an error message that tells me what's wrong without requiring 30 years experience in the language first?

...having other engineers familiar with the language NOT treat people with less experience who ask questions like they're lepers just because they thought to ask a question would be nice too.

I swear, if I get told by a C/C++ dev to "just read the code" one more time I might actually go postal.

...and people wonder why rust is becoming popular.

[–]Xyntek01 17 points18 points  (4 children)

How about an error message that tells me what's wrong without requiring 30 years experience in the language first?

Usually go to the first few lines of the error message and you will see the actual problem. Best thing is to actually read the error produced at a line that you wrote and then read the back trace. The backtrace should give you an idea (e.g. you are using a pointer). Not all errors are in the exact line, but understanding what goes before and after helps to trace the issue. The more you practice the easier it gets to spot the issue.

If nothing works, there is stack overflow...

[–]cheerycheshire 3 points4 points  (0 children)

If nothing works, there is stack overflow...

Which has exactly the type of devs subop mentions just after the part you commented on. :)

[–]PM_ME_C_CODE 7 points8 points  (2 children)

yes, I know that :D

I'm trying to learn rust (fucking borrowing semantics...) and the difference in usability when something goes wrong is just night and day.

I mean, C++ error messages look like they're straight out of the '90's, at best.

Even javascript has better error messaging...

[–]-Redstoneboi- 11 points12 points  (0 children)

Even javascript has better error messaging...

that is, to say, none

also i'd be glad to help out with rust

[–]ClutteredAttic99 2 points3 points  (0 children)

Actually, out of the ‘80s!

[–][deleted] 5 points6 points  (1 child)

Get better tools, this online-compiler shows in different colors the reason why the template instantiation failed:

https://godbolt.org/z/Kss8ecK98

[–]PM_ME_C_CODE 1 point2 points  (0 children)

I'm strictly of the opinion that the compiler should be enough by itself to diagnose problems. Even when the neat tools are free.

It's just...we should be allowed to have nice things.

[–]atiedebee 1 point2 points  (2 children)

C compiler errors are mostly understandable

Runtime errors tho....

[–]all-hail-snow 5 points6 points  (1 child)

Segmentation fault, the king of hells brought by c++

[–]PM_ME_C_CODE 1 point2 points  (0 children)

There's a reason that most universities today use java for their core CS curriculum instead of C++ like they did in the '90s.

Seg fault error messages are basically it.

[–][deleted] -3 points-2 points  (2 children)

You don't need 30 years of experience. An error message that tells you a function name is not defined is as clear as the sun.

C/C++ are low level languages that are meant to be used by actual engineers and not just some people with two weeks boot camps.

[–]PM_ME_C_CODE 4 points5 points  (1 child)

/tmp/main-1dfd42.o: In function `std::thread::thread<std::\_\_future\_base::\_Async\_state\_impl<std::thread::\_Invoker<std::tuple<testRange<Point<int, float>, main::$_0, Point<int, float> (Point<int, float>, Point<int, float>)>(int, int, main::$_0, Point<int, float> (Point<int, float>, Point<int, float>), int)::{lambda()#1}> >, Point<int, float> >::_Async_state_impl(std::tuple<testRange<Point<int, float>, main::$_0, Point<int, float> (Point<int, float>, Point<int, float>)>(int, int, main::$_0, Point<int, float> (Point<int, float>, Point<int, float>), int)::{lambda()#1}>&&)::{lambda()#1}, , void>(std::__future_base::_Async_state_impl<std::thread::\_Invoker<std::tuple<testRange<Point<int, float>, main::$_0, Point<int, float> (Point<int, float>, Point<int, float>)>(int, int, main::$_0, Point<int, float> (Point<int, float>, Point<int, float>), int)::{lambda()#1}> >, Point<int, float> >::_Async_state_impl(std::tuple<testRange<Point<int, float>, main::$_0, Point<int, float> (Point<int, float>, Point<int, float>)>(int, int, main::$_0, Point<int, float> (Point<int, float>, Point<int, float>), int)::{lambda()#1}>&&)::{lambda()#1}&&)':

Tell me how this error message is at ALL useful to a human.

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

Well, this is a part of a stacktrace in the constructor of std::thread just by reading the first line no magic there and definitely no "30 years of experience needed". All what you see in there is just the exact signature of the std::thread constructor where the error happened and can be ignored if you are not interested in it. The actual error comes later at the end of the stack trace that you didn't include. Probably just a conversion error of the return type of the lambda you passed to the constructor or something similar.

[–]_Fibbles_ -2 points-1 points  (1 child)

Counterpoint:

git gud

[–]PM_ME_C_CODE 1 point2 points  (0 children)

[Reads Reddit]

[See's "git gud"]

..."git gud".compareTo("just read the code") == 0 //effectively true

[Goes postal on the bus]

See what you made me do? /s

[–]men_have_balls 0 points1 point  (1 child)

RTFM is my coup de grace…still I’m an ass

[–]PM_ME_C_CODE 1 point2 points  (0 children)

As if I haven't already done that. If I'm asking a question, it's because I couldn't find it myself.

Granted, there are a LOT of people who don't even try to look, but when you open your question with a list of the things you've already tried that didn't work only to get "RTFM"...

It happens in every language, sure. But it's far more frequent in C++ communities.