1009
C++ Moment (lemmy.world)
top 50 comments
sorted by: hot top controversial new old
[-] Strykker@programming.dev 139 points 9 months ago

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.

[-] neosheo@discuss.tchncs.de 50 points 9 months ago

Where does it write the file

[-] Agent641@lemmy.world 74 points 9 months ago
[-] Plasma@lemmy.ml 22 points 9 months ago

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

[-] Swedneck@discuss.tchncs.de 55 points 9 months ago

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

[-] PotatoesFall@discuss.tchncs.de 25 points 9 months ago

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

[-] ysjet@lemmy.world 14 points 9 months ago

gdb gives you waaaaaaaaaaaaaaay more than a stack trace.

load more comments (3 replies)
load more comments (6 replies)
[-] elxeno@lemm.ee 17 points 9 months ago

you can set it

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

[-] soulsource@discuss.tchncs.de 16 points 9 months ago

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

[-] lowleveldata@programming.dev 89 points 9 months ago

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

[-] Aurenkin@sh.itjust.works 16 points 9 months ago

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)
[-] FlatFootFox@lemmy.world 84 points 9 months ago

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.

[-] ignotum@lemmy.world 50 points 9 months ago

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

load more comments (1 replies)
[-] Dirk@lemmy.ml 77 points 9 months ago

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

[-] WhiteHawk@lemmy.world 47 points 9 months ago

Mixing spaces and tabs should be a warcrime.

load more comments (19 replies)
[-] xigoi@lemmy.sdf.org 22 points 9 months ago

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)
[-] ElCanut@jlai.lu 73 points 9 months ago* (last edited 9 months ago)

Rust developer: I'd like to compile some code

Rust compiler: the fuck you are

[-] malle_yeno@pawb.social 43 points 9 months ago

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.

[-] ElCanut@jlai.lu 29 points 9 months ago

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)

I need a rust compiler in my life 😍

load more comments (6 replies)
[-] crispy_kilt@feddit.de 59 points 9 months ago
[-] henfredemars@infosec.pub 36 points 9 months ago* (last edited 9 months ago)

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)
[-] ScreamingFirehawk@feddit.uk 54 points 9 months ago

Embedded C entered the chat

[-] flubba86@lemmy.world 47 points 9 months ago

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

load more comments (2 replies)
[-] mindbleach@sh.itjust.works 31 points 9 months ago

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

[-] elxeno@lemm.ee 51 points 9 months ago
[-] TheDudeV2@lemmy.ca 15 points 9 months ago* (last edited 9 months ago)

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)
[-] Socsa@sh.itjust.works 39 points 9 months ago

Imagine unironically praising Java.

[-] flubba86@lemmy.world 29 points 9 months ago* (last edited 9 months ago)

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.

[-] Lemzlez@lemmy.world 15 points 9 months ago

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)
[-] spacebanana@lemmy.world 20 points 9 months ago* (last edited 9 months ago)

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)
[-] humbletightband@lemmy.dbzer0.com 14 points 9 months ago

Java is good. Supporting Java legacy is bad

load more comments (6 replies)
[-] Flxibit@lemmy.world 37 points 9 months ago

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

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

[-] FiskFisk33@startrek.website 29 points 9 months ago* (last edited 9 months ago)

Average C++ error

Average C++ error

[-] vox@sopuli.xyz 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)

[-] ooterness@lemmy.world 24 points 9 months ago

No bounds checking, only fast.

[-] tunetardis@lemmy.ca 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)
[-] Subverb@lemmy.world 22 points 9 months ago

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)
[-] repungnant_canary@lemmy.world 19 points 9 months ago

Joke on you until the python program segfaults

load more comments (1 replies)
[-] AMDIsOurLord@lemmy.ml 18 points 9 months ago

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)
[-] kbal@fedia.io 18 points 9 months ago
[-] heavy@sh.itjust.works 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 ›
this post was submitted on 28 Feb 2024
1009 points (97.0% liked)

Programmer Humor

32572 readers
102 users here now

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

Rules:

founded 5 years ago
MODERATORS