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

In modern c++ you can get away without it by using a combination of RAII and the various shared pointer and container features.

It's an odd mental leap for this old C hack, but it works quite well when you get into it. Bonus - no 'free' or 'delete' necessary.



Please correct me if I am wrong, but RAII isn't flexible enough to allow for lazy initialization. the various STL pointer types (std::shared_ptr etc..) are great, but they do incur overhead, and sometimes that is not acceptable in e.g. embedded systems.




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

Search: