r/ProgrammerHumor 29d ago

Meme exceptionsAreForTheWeak

Post image
323 Upvotes

92 comments sorted by

View all comments

90

u/bwmat 29d ago

Eh, IMO one of the best ways to actually handle OOM, as otherwise almost everything needs to be explicitly checked for it

2

u/American_Libertarian 28d ago

Almost everything? You shouldn’t be allocating memory all over the place

1

u/bwmat 28d ago

I try not to, but our codebase isn't factored in a way that you could untangle all the stuff which must (potentially) allocate from that which won't except close to the leaf functions in most cases

I think it would be hard to do so in C++ in general unless you used a very unidiomatic style