C#: Time for a treasure hunt! Find the Null Reference Exception. Here's a map. X marks the spot.
Programmer Humor
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.
gdb ./fuck
r
where
you should get a complete stack trace (complete with values of some function arguments)
The ole' single C++ error turning into 600 lines of issues
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.
puts me in mind of the old guru meditation error messages that popped up in the stone knives and bearskins era of computing.
Why doesn't JavaScript have tracebacks?
How useful would they be when they rely to such a large extent on various callback functions?
Where's rust?
Rust: this garbage code is beneath me, come back when you have your shit together.
Compilation: top row, runtime: button row.
Rust required you to fix all the errors before running the code.
Runtime errors are still a thing.
Compared to that trio, they are a rarity that make people excited just to spot one.
Runtime errors are rare? Interesting. I guess it depends on how much error handling the dev additionally wants to do.
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.
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.
Python: So you used spaces and tabs for indentation? NOW DIE!
Mixing spaces and tabs should be a warcrime.
Find me anyone who claims they use tabs for indentation, and I bet I'll find at least one case where they're using both tabs and spaces.
The only safe way to avoid war crimes is to avoid tabs.
I use the tab key but I'm pretty sure vs code converts that to spaces
Are you ok?
Good. Spaces and tabs for indentation should never be mixed in any language other than Whitespace.
At least you are getting a dump, count your blessings. Could be worse!
Just hook your app to a debugger and load the dump.
No bounds checking, only fast.
There is bounds checking, but it's opt-in. I often enable it on debug builds.
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).