this post was submitted on 28 Feb 2024
1012 points (97.0% liked)

Programmer Humor

32718 readers
538 users here now

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

founded 5 years ago
MODERATORS
 
top 50 comments
sorted by: hot top controversial new old
[–] [email protected] 139 points 9 months ago (1 children)

Except the C++ "Core dumped" line is telling you it just wrote a file out with the full state of the program at the time of the crash, you can load it up and see where it crashed and then go and look at what every local variable was at the time of the crash.

Pretty sure you can even step backwards in time with a good debugger to find out exactly how you got to the state you're currently in.

[–] [email protected] 50 points 9 months ago (4 children)

Where does it write the file

[–] [email protected] 74 points 9 months ago (1 children)
[–] [email protected] 22 points 9 months ago (1 children)

I believe it's /var/lib/apport/coredump on Ubuntu.

[–] [email protected] 55 points 9 months ago (7 children)

imagine if it, like, told you this so you didn't have to find out about it via a post on lemmy

[–] [email protected] 25 points 9 months ago (1 children)

imagine if it like, read that file and gave you a stack trace

[–] [email protected] 14 points 9 months ago (3 children)

gdb gives you waaaaaaaaaaaaaaay more than a stack trace.

load more comments (3 replies)
load more comments (6 replies)
[–] [email protected] 17 points 9 months ago

you can set it

tl;dw: writes to the path in /proc/sys/kernel/core_pattern

[–] [email protected] 16 points 9 months ago

If you are using systemd, there's a tool called coredumpctl.

[–] [email protected] 90 points 9 months ago (7 children)

let's not act like Java's error log is useful

[–] [email protected] 16 points 9 months ago (1 children)

I think it's pretty useful, be interested to hear your hangups with it though because it's definitely not perfect.

If something goes wrong and I have a stack trace, that plus the type of exception will almost always be enough for me to figure out what's wrong at least as a starting point. I've worked mostly with JVM languages in my career though so maybe I just don't know how bad it actually is.

load more comments (1 replies)
load more comments (5 replies)
[–] [email protected] 84 points 9 months ago (1 children)

My favorite compile error happened while I was taking a Haskell class.

ghc: panic! (the 'impossible' happened)

The issue is plainly stated, and it provides clear next steps to the developer.

[–] [email protected] 50 points 9 months ago (1 children)

I had a similar error, though not from the compiler
Error message just read this should never happen

load more comments (1 replies)
[–] [email protected] 77 points 9 months ago (4 children)

Python: So you used spaces and tabs for indentation? NOW DIE!

[–] [email protected] 47 points 9 months ago (19 children)

Mixing spaces and tabs should be a warcrime.

load more comments (19 replies)
[–] [email protected] 22 points 9 months ago (3 children)

Good. Spaces and tabs for indentation should never be mixed in any language other than Whitespace.

load more comments (3 replies)
load more comments (2 replies)
[–] [email protected] 73 points 9 months ago* (last edited 9 months ago) (1 children)

Rust developer: I'd like to compile some code

Rust compiler: the fuck you are

[–] [email protected] 43 points 9 months ago (8 children)

The rust compiler holds your hand, wraps you in blankets, makes you hot chocolate, kisses you on the forehead before it gently and politely points out what you did wrong and how you can solve it step-by-step. It would never think of something as heinous as swearing at you, shame on you for insulting my wife's honour like this.

[–] [email protected] 29 points 9 months ago (1 children)

Rust compiler is passive agressive, like:

"There's an error at line 286 because you still don't know how to use the borrow checker after all this time ♥️"

load more comments (1 replies)
[–] [email protected] 20 points 9 months ago

I need a rust compiler in my life 😍

load more comments (6 replies)
[–] [email protected] 59 points 9 months ago (1 children)
[–] [email protected] 36 points 9 months ago* (last edited 9 months ago) (2 children)

Yes. It's a surprisingly bad debugger the more you think about it. I use it largely in assembly and it loves to spit out random errors about memory it tried to access based on the current register state. The shortcuts are kind of dumb.

It certainly works but I wouldn't call it a pleasure to use.

Ex: try disp x/1i $eip often just doesn't work.

load more comments (2 replies)
[–] [email protected] 54 points 9 months ago (2 children)

Embedded C entered the chat

[–] [email protected] 47 points 9 months ago (2 children)

Your loop had a race condition, so we let the smoke out for you.

load more comments (2 replies)
[–] [email protected] 31 points 9 months ago

// I am responsible for every byte of this code and still don't know why this line breaks everything.

[–] [email protected] 51 points 9 months ago (2 children)
[–] [email protected] 15 points 9 months ago* (last edited 9 months ago) (3 children)

https://www.youtube.com/@TsodingDaily

If you're a programmer, or think you might want to be one, I highly recommend this channel. He's a savant at all sorts of low level things, quite funny and entertaining, and does a fantastic job of explaining what's going on.

load more comments (3 replies)
load more comments (1 replies)
[–] [email protected] 39 points 9 months ago (9 children)

Imagine unironically praising Java.

[–] [email protected] 29 points 9 months ago* (last edited 9 months ago) (1 children)

The one thing I can say about java; the kinds of people who like Java tend to really like Java. Everyone else just leaves them to it.

[–] [email protected] 15 points 9 months ago (6 children)

And the people hating on it somehow never used any version above 8, which is 10 years old and EOL.

load more comments (6 replies)
[–] [email protected] 20 points 9 months ago* (last edited 9 months ago) (4 children)

Java is a traditional and conservative language, which has its strong upsides, like the syntax being familiar to many people who haven't used the language before. It's a language that brought us the JVM, gave a job to many people and established fundamentals for other languages to inspire and improve on. If you don't like Java, you can just use another language for the JVM, like Scala, Kotlin or Clojure.

load more comments (4 replies)
[–] [email protected] 14 points 9 months ago

Java is good. Supporting Java legacy is bad

load more comments (6 replies)
[–] [email protected] 37 points 9 months ago (1 children)

This C++ message has an urgency vibes to it:

"Segmentation fault!! Drop the Nuclear Reactor quick!!"

[–] [email protected] 29 points 9 months ago* (last edited 9 months ago)

Average C++ error

Average C++ error

[–] [email protected] 28 points 9 months ago* (last edited 9 months ago)
gdb ./fuck
r
where

you should get a complete stack trace (complete with values of some function arguments)

[–] [email protected] 24 points 9 months ago (6 children)

No bounds checking, only fast.

[–] [email protected] 14 points 9 months ago

There is bounds checking, but it's opt-in. I often enable it on debug builds.

load more comments (5 replies)
[–] [email protected] 22 points 9 months ago (5 children)

Nevermind that the C++ program is two orders of magnitude faster when completed.

I would love to learn and use Rust but I'm a embedded systems guy. Everything of consequence is C and C++.

load more comments (5 replies)
[–] [email protected] 19 points 9 months ago (1 children)

Joke on you until the python program segfaults

load more comments (1 replies)
[–] [email protected] 18 points 9 months ago
[–] [email protected] 18 points 9 months ago (5 children)

The developer must either provide the logging and attach a debugger or go get fucked when a runtime error happens

load more comments (5 replies)
[–] [email protected] 17 points 9 months ago

I know this is supposed to be humorous, but there's a reason why these languages can, and are doing what they're doing.

Core dumps are also worth learning about, they're really helpful if you understand them.

load more comments
view more: next ›