Comment

Comment by lelanthran

> Handling OOM gracefully - i.e. doing anything other than immediately crashing and/or invoking undefined behaviour - is absolutely not the default in C.

What are you talking about? Every allocation must be checked at the point of allocation, which is "the default"

If you write non-idiomatically, then sure, in other languages you can jump through a couple of hoops and check every allocation, but that's not the default.

The default in C is to return an error when allocation fails.

The default in C++, Rust, etc is to throw an exception. The idiomatic way in C++, etc is to not handle that exception.

parent lelanthran 10 months ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton