News for hackers. Stuff that matters.
Re:Use Noexcept for Exception Handling in C++ Programs by jcelerier on Wednesday January 01, 2020 @05:19AM (#21927465)
> int* array = new int[n];

that's why you do `auto array = std::make_unique<int[]>(n);` (or `auto array = std::make_unique_default_init<int[]>(n);` if you don't believe in your compiler's ability to optimize redundant writes)

Also, this "memory leak" is only an issue on pre-1990 operating systems as "current" operating systems have no trouble reclaiming unfreed memory - you loose exactly the same amount of memory in both cases : zero.

So no, don't litter noexcept everywhere, especially for that, this article just does not make sense.

Re:Use Noexcept for Exception Handling in C++ Programs by shakna on Wednesday January 01, 2020 @05:45AM (#21927534)
> Also, this "memory leak" is only an issue on pre-1990 operating systems as "current" operating systems have no trouble reclaiming unfreed memory

Not just that, the OS is faster to reclaim the unfreed memory than if the program was cleaning it up.

Re:Use Noexcept for Exception Handling in C++ Programs by _rtld_global_ro on Wednesday January 01, 2020 @10:18AM (#21928312)
It's only true if the program is about to exit, for long running programs like daemons, ``memory leak`` is still a thing.
Re:Use Noexcept for Exception Handling in C++ Programs by tos1 on Wednesday January 01, 2020 @05:52AM (#21927560)
Also, make_unique<int[]> would not be UB: The post matches new[] with delete and does not even care about valgrind mentioning this.
Re:Use Noexcept for Exception Handling in C++ Programs by pjmlp on Wednesday January 01, 2020 @06:02AM (#21927579)
And critical embedded OSes running on IoT devices, but who cares about that. /s
Re:Use Noexcept for Exception Handling in C++ Programs by jcelerier on Wednesday January 01, 2020 @06:17AM (#21927614)
> And critical embedded OSes running on IoT devices, but who cares about that.

are there current non-homegrown RTOSes that do not reclaim memory ? I know that QNX does.

Re:Use Noexcept for Exception Handling in C++ Programs by pjmlp on Wednesday January 01, 2020 @06:52AM (#21927689)
Probably not, but not having to depend on such factors is good engineering and security best practices.