this post was submitted on 28 Feb 2024
317 points (95.2% liked)

Programmer Humor

22351 readers
2178 users here now

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

founded 2 years ago
MODERATORS
 
all 35 comments
sorted by: hot top controversial new old
[–] [email protected] 61 points 1 year ago (2 children)

Meanwhile Rust: you might get an error at line 45 word 3 because it assumes variable foo is an int32 but it could be (whatever else idk), let's not compile this before you correct this by changing line 43 in this specific way. Here's the before and after code snippets so you can just copy-paste the fix.

[–] [email protected] 36 points 1 year ago (1 children)

Man I fucking love the Rust compiler. Easily the most understandable and useful error messages I've ever seen.

[–] [email protected] 10 points 1 year ago (1 children)

Have you seen Elm's error messages? They were what inspired Rust to have its error messages.

[–] [email protected] 3 points 1 year ago

I like how Elm error messages are like the compiler talking to you as a person.

[–] [email protected] 18 points 1 year ago (1 children)

In my IDE there us even a button for accepting the compilers recommend fix. This is only possible because the error messages and recommendations are that good.

[–] [email protected] 11 points 1 year ago

Hm. Rust sounds better and better every time I hear something new about it.

[–] [email protected] 40 points 1 year ago (1 children)

JavaScript: error: undefined is undefined or some nonsense like that. Sorry to repeat the old JavaScript bad, but I really hate debugging JavaScript!

[–] Tja 20 points 1 year ago (1 children)
[–] [email protected] 8 points 1 year ago

My favorite error! I saw that so many times it stopped surprising me lol

[–] Tja 31 points 1 year ago (2 children)

Someone needs to be introduced to gdb...

[–] [email protected] 4 points 1 year ago

This is the Way

[–] parens 0 points 1 year ago (1 children)

have fun without those debug symbols

[–] Tja 10 points 1 year ago (1 children)

Why wouldn't I have debug symbols in the software I'm developing?

[–] parens 0 points 1 year ago (2 children)

And what happens when you release it?

[–] Tja 5 points 1 year ago

If you want the same traces as Java and python in the meme, you leave them, if you don't you strip them. Or you ship them separately. You decide, like a big boy.

[–] [email protected] 1 points 1 year ago

Have the user compile it without debug symbols to save space. If the user has a problem they can just recompile it with debug symbols and see what went wrong with gdb.

[–] [email protected] 16 points 1 year ago (2 children)

It's been a minute since I used C/Cpp but if you compile with debugging symbols and using gdb give you info like in Java? At least the location of the crash.

[–] [email protected] 13 points 1 year ago (2 children)

And then you realise the program doesn't crash when compiling with debug symbols 😢

[–] [email protected] 8 points 1 year ago

Then it's time to have a closer look at how your concurrent threads are behaving and where you missed a sync point or mutex.

[–] mrkite 4 points 1 year ago

That's when you break out valgrind because you certainly are using uninitialized memory.

[–] [email protected] 2 points 1 year ago

And much more, it tells you each operation it goes through, where it is in the code, what's in the registers and more.

[–] [email protected] 15 points 1 year ago

But it returned 139! That's a start even without a debugger!

[–] [email protected] 11 points 1 year ago

PHP: Error on Line 0 in undefined.

[–] [email protected] 11 points 1 year ago

I have segfaulted in all those languages.

[–] [email protected] 10 points 1 year ago (1 children)

And C/C++ are like that by design. Compiled languages were new and the developers were afraid additional checks would decrease performance. It was certainly performant in racing toward a crash.

[–] [email protected] 5 points 1 year ago

And C/C++ are like that by design. Compiled languages were new and the developers were afraid additional checks would decrease performance.

If you have a credible citation showing that was what guided K&R's decisions, I think you should post it.

[–] [email protected] 7 points 1 year ago (1 children)

but with a core dump you can just load it up and see the state of the process when it crashed...

[–] mrkite 3 points 1 year ago (1 children)

I'm trying to remember the last time I actually had a core file. I think core dumps have been disabled by default on Linux since at least 2000.

[–] Tja 2 points 1 year ago (1 children)

They are stored in the system log and thus rotated automatically to save storage. At least in Arch.

I use Arch, BTW.

[–] [email protected] 1 points 1 year ago
[–] [email protected] 4 points 1 year ago

Story time. Back at uni I had a c++ subject. Me being lazy as fuck I didn't attend many classes and let alone do the practicals during the semester. Exam time comes around. I realise I can't cram in a whole semester's learning in a week. Luckily it's open book exam. Big brain time, I print the whole c++ documentation to take into the exam. I frantically page through the hundreds of pages in my lever arch file looking for answers. I pretty much copy and write example code to questions. Very sad when I failed.

[–] [email protected] 2 points 1 year ago
gdb> break before it crashes
gdb> record full
gdb> continue
(segfault)

gdb> set exec-direction reverse

[–] [email protected] 2 points 1 year ago

cries in verilog

[–] [email protected] 1 points 1 year ago

The code editor I had to use for Java once didn't give me anything like that.

Meanwhile for C you can just use gdb, it's great!