Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Does anyone know of large projects where C++ handles memory allocation failures gracefully? For services that need to stay up and never crash under memory pressure, I would think C is the way to go. It's too hard to reason about control flow with exceptions.


You don't have to use exceptions in C++. You can do stuff the same way as in C by checking the return pointer.

I've worked on C++ apps that had built-in garbage collection (basically asset (geometry) paging) for huge amounts of data that would allocate/free/page on demand based on what was going on.


Sure, but then you can't use the standard library or any other libraries. Even a single exception sneaking into the codebase breaks everything.


We did - loads of Qt and std:: stuff - admittedly we used a custom memory allocator for the std:: stuff, but it worked fine.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: