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

C++ RAII is completely gone without the use of classes; it requires something with a destructor.


I guess the OP means pod types (plain Cish structs) where dtors are implicit.


But then what's left of RAII? What resource is there to allocate other than the memory itself? RAII means more than just "get memory to put this in".


Presuming GP includes unique_ptr, there's no real loss of RAII. In my opinion you might as well write trivial classes, but hey, to each his own.




Consider applying for YC's Fall 2026 batch! Applications are open till July 27.

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

Search: