News for hackers. Stuff that matters.
Re:Current hardware trends make C++ exceptions harder to jus... by andi999 on Tuesday February 22, 2022 @02:12PM (#30432215)
How do you get memory without new nowadays?
Re:Current hardware trends make C++ exceptions harder to jus... by usefulcat on Tuesday February 22, 2022 @02:22PM (#30432328)
They’re probably referring to preferring std::make_unique or std::make_shared to bare new/delete. Using either of the former makes the ownership semantics clear and avoids the need to remember to call delete at the appropriate time.
Re:Current hardware trends make C++ exceptions harder to jus... by chlorion on Wednesday February 23, 2022 @05:31PM (#30447474)
As well as smart pointers as others have mentioned, standard library containers (other than smart pointers) are another way to handle dynamic allocations in certain situations. The vector container is probably the best example here, it alone provides massive safety and usability benefits over using new or malloc directly!
Re:Current hardware trends make C++ exceptions harder to jus... by kaetemi on Tuesday February 22, 2022 @02:17PM (#30432273)
make_unique, etc.