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.
<span style="color:#323232;">gdb> break before it crashes
</span><span style="color:#323232;">gdb> record full
</span><span style="color:#323232;">gdb> continue
</span><span style="color:#323232;">(segfault)
</span>
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.
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.
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.
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.
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.
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.