Welcome to Software Development on Codidact!
Will you help us build our independent community of developers helping developers? We're small and trying to grow. We welcome questions about all aspects of software development, from design to code to QA and more. Got questions? Got answers? Got code you'd like someone to review? Please join us.
Is there any benefit to using new?
I've heard that in modern C++, smart pointers are preferred to raw pointers for ownership (the so-called RAII principle, as I understand it).
This makes sense, and since then I've always used them throughout my projects. This makes me realize though, that I can't really remember the last time I've used
new to allocate anything and have started to wonder if it's actually useful anymore.
In what (if any) situations are there benefits in using
new to allocate memory over