asudox
link
fedilink
910M

Where’s rust?

Rust required you to fix all the errors before running the code.

asudox
link
fedilink
710M

Runtime errors are still a thing.

Compared to that trio, they are a rarity that make people excited just to spot one.

Turun
link
fedilink
510M

I have a graphical application that crashes regularly when I switch between displays with Ctrl+alt+number. Something in the winit stack does not like it.

asudox
link
fedilink
2
edit-2
10M

Runtime errors are rare? Interesting. I guess it depends on how much error handling the dev additionally wants to do.

Turun
link
fedilink
210M

Compilation: top row, runtime: button row.

Rust: this garbage code is beneath me, come back when you have your shit together.

@Buttons@programming.dev
link
fedilink
English
210M

Why doesn’t JavaScript have tracebacks?

How useful would they be when they rely to such a large extent on various callback functions?

Subverb
link
fedilink
2210M

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++.

There’s embedded rust for a few platforms. Using it on ESPs is fun

Subverb
link
fedilink
610M

I meant faster than Python, not faster than Rust. Rust is fast.

Ah. OK. Makes more sense.

@T156@lemmy.world
link
fedilink
English
1210M

If the embedded system is old or poorly-maintained enough, there might be more Rust than you’d think.

More like 100 lines of template errors

If only I could show segfaul stack tracetrough looped macros.

It breaks VSCode (it would be hilarious if I wasn’t the author of said macros).

@ElCanut@jlai.lu
link
fedilink
73
edit-2
10M

Rust developer: I’d like to compile some code

Rust compiler: the fuck you are

Malle_Yeno
link
fedilink
4310M

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.

I don’t know from where this legend comes from but lifetimes/concurrency/macros errors are brain-hurting.

Most of the time I find myself dropping project because I wrote my program in a correct way but Rust just does not like how it is designed lol. I can’t get shit done with this language

Damn right. And once it compiles… it works.

Meet my friend: .unwrap()

Fair.

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 ♥️”

its a compiler. That is at best projection, especially considering how the compiler’s error feedback is designed to be firm yet gentle.

except when it gives errors about lifetimes of some object.

boy, that makes my brain hurt

The rust compiler produces a flawless understanding of your code, and then quits out because understanding that code is a Nightly-only feature and you’re using the stable build.

I need a rust compiler in my life 😍

@ooterness@lemmy.world
link
fedilink
English
2410M

No bounds checking, only fast.

This right here - C++ iirc is used mostly for microprocessor code in an industry setting, where EXTENSIVE testing is done so that bloated code doesn’t need to constantly check for programmer errors every single time, i.e. where execution speed is prioritized over programmer development time. And whenever that is not the case, well, as OP pointed out, other higher-level languages also exist (implication: to choose from).

I also currently use it for a new project since all needed 3rd party libraries are from a very specific domain and the project has a deadline, so writing and testing wrappers for Rust that would provide me with any meaningful advantages down the road are too costly to budget for before the deadline.

That could become part of a future refactoring, though.

C++ iirc is used mostly for microprocessor code

lol no, it’s used almost everywhere where performance is important and people want(ed) OOP, from tiny projects to web browsers (Chrome, Firefox) to game engines (Unreal, CryEngine). Many of these are hugely complex and do encounter segfaults on a somewhat frequent basis.

Saying C++ is mostly used for embedded applications is like saying C# is mostly used for scripting games, i.e. it doesn’t nearly cover all the use cases.

higher-level languages also exist

This depends on your definition of “higher-level”, but many people would argue that C++ is on a similar level to Java or C# in terms of abstraction. The latter two do, however, have a garbage collector, which vastly simplifies memory management for the programmer(generally anyway).

deleted by creator

@tool@lemmy.world
link
fedilink
English
210M

Lots of those in C# now, especially with Unity coming along like it did.

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

At least you are getting a dump, count your blessings. Could be worse!

Just hook your app to a debugger and load the dump.

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

skill issue

The same applies to using the core dump.

In fact, the Python one is the lest useful of the trio.

When the day comes that you need gdb you will indeed be amazed at how fucking powerful it is. If your server crashes grab that core dump!

@Omega_Haxors@lemmy.ml
link
fedilink
English
110M

Implying you can’t consistently go to the same line every time and it always has what you need.

Skull giver
link
fedilink
131
edit-2
10M

deleted by creator

you can follow any exception down to the exact line of code

Which is usually not a piece of code written by us and is caused by another piece of code not written by us either

Does your IDE not highlight the lines written by you in a different colour? Of course that doesn’t help when it’s an error in production!

Is it possible to make intelliJ do this?

I thought it highlighted the line number in blue when it was your code. I use eclipse so can’t properly remember

Skull giver
link
fedilink
5
edit-2
10M

deleted by creator

kbal
link
fedilink
52
edit-2
10M

Super-advanced java devs like me do it like try{} catch (Exception e) { System.out.println("something went wrong"); e.printStackTrace(); }

Skull giver
link
fedilink
53
edit-2
10M

deleted by creator

@kaffiene@lemmy.world
link
fedilink
English
410M

Yeah cos everyone knows other languages are impossible to write bad code with

On Error Resume Next never before have more terrible words been spoken.

@tool@lemmy.world
link
fedilink
English
810M

On Error Resume Next never before have more terrible words been spoken.

Every time I’m reading a PowerShell script at work and see -ErrorAction SilentlyContinue I want to scream into a pillow and forcefully revert their commit.

I’ve actually done it a few times, but I want to do it every time.

And that’s why you’re a hero.

but you can follow any exception down to the exact line of code (or JNI call, I guess) where the problem occurs.

But, it’s not really where the problem occurred. How often do you get a stack trace and the bug fix is at the line referenced by the stack trace? Almost never. It’s more that it takes you down to the exact line of code where the effects of the problem are bad enough to affect the running of the program. But, the actual problem happened earlier, sometimes much earlier.

For example, NullPointerException isn’t actually the problem, it’s a symptom of the problem. Something didn’t get initialized properly, and nobody noticed for a while, until we tried to use it, and got a null pointer. Sometimes it’s easy to go from the effect (null pointer) to the cause (uninitialized thing). But, other times that “thing” was passed in, so you have to work backwards to try to figure out where that thing comes from, and why it’s in that broken state.

Sure, it’s better than nothing, but it’s still frustrating.

Skull giver
link
fedilink
13
edit-2
10M

deleted by creator

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.

@kaffiene@lemmy.world
link
fedilink
English
110M

It’s not bad. It’s better than what most languages give you

@kaffiene@lemmy.world
link
fedilink
English
710M

It’s extraordinarily useful

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

are you c++?

@Faresh@lemmy.ml
link
fedilink
10
edit-2
10M

That’s not true though. You can get the backtrace and other useful information from the coredump mentioned by the error message by loading it with gdb. Not as good as attaching it to a living process, since you can’t see step-by-step what happens leading up to the error, but still quite useful.

Well yes, that’s a pretty good way of debugging a third party app but if you are developing something you can have more ease with gdb attached

You can also debug post-mortem with the minidump or the core dump file with WDT on Windows. Great fun and a good way to brush up on your assembly skills

Great fun and a good way to brush up on your assembly skills

Just load it on the debugger and leave your asm skill gather patina.

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

“Segmentation fault!! Drop the Nuclear Reactor quick!!”

Average C++ error

Average C++ error

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
link
fedilink
5010M

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

Ah, good old PlarformIO

@TheDudeV2@lemmy.ca
link
fedilink
15
edit-2
10M

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.

Good gods, a long-form content creator! Will be checking this out later

voxel
link
fedilink
110M

he’s russian tho

Russ
link
fedilink
English
410M

tsoding’s channel is one I look forward to watching every single day, never a dull moment in his streams/videos.

If you’re someone who likes to watch things live, his Twitch channel is available here.

The guy is testing the result of malloc and you are complaining about how?

Embedded C entered the chat

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

Can’t believe that my code is racist smh

Ho hoo, that isn’t smoke, it’s steam, from the steamed rams we’re having! Mmm, steamed rams.

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

@heavy@sh.itjust.works
link
fedilink
English
1710M

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.

@Omega_Haxors@lemmy.ml
link
fedilink
English
4
edit-2
10M

C#: Time for a treasure hunt! Find the Null Reference Exception. Here’s a map. X marks the spot.

Kogasa
link
fedilink
610M

C# tells you the call site/method name and line number right at the top. It’s only really annoying when you have aggregate exceptions, which sometimes occur because someone async’d wrong

@Omega_Haxors@lemmy.ml
link
fedilink
English
210M

Actually getting there is the other part. It’s not like java where you can go down the chain if the problem isn’t where it says it is.

Create a post

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

Rules:

  • Posts must be relevant to programming, programmers, or computer science.
  • No NSFW content.
  • Jokes must be in good taste. No hate speech, bigotry, etc.
  • 1 user online
  • 50 users / day
  • 169 users / week
  • 442 users / month
  • 2.42K users / 6 months
  • 1 subscriber
  • 1.61K Posts
  • 35.6K Comments
  • Modlog