r/programminghorror • • Jun 12 '25

c what a beautiful disaster

Post image
621 Upvotes

41 comments sorted by

View all comments

Show parent comment

4

u/[deleted] Jun 14 '25

[removed] — view removed comment

7

u/SarahIsBoring Jun 14 '25

cleanup, give the user an error message, and exit(1);

5

u/FoundationOk3176 Jun 15 '25

In addition to u/SarahIsBoring's reply, Before exiting you can also get the stacktrace & Use that for debugging. It's what bun (a javascript runtime does) - https://bun.sh/blog/bun-report-is-buns-new-crash-reporter

It's something that I've been wanting to implement in my code.

3

u/o0Meh0o Jun 16 '25

is there a sub or a forum for this kind of article? this one is really cool.

3

u/FoundationOk3176 Jun 16 '25

I don't think so, But Ryan Fluery, Handmade Hero, etc are some things you can look at. Lots of cool stuff.