You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Please make implementations of these operator standard conformant. Those variants of new, which are already present in wiring library must check return value of malloc and, in case of memory allocation error call std::terminate. The reason is that nobody checks return value of new because it always returns valid address. So if you return 0 the firmware would crash badly because of memory corruption.
If programmer wants to check for address returned by new, he must call nothrow version of new which should be provided by the library.
There is also placement new, which is a must have tool for writing containers, such as circular buffer.
Please make implementations of these operator standard conformant. Those variants of new, which are already present in wiring library must check return value of malloc and, in case of memory allocation error call std::terminate. The reason is that nobody checks return value of new because it always returns valid address. So if you return 0 the firmware would crash badly because of memory corruption.
If programmer wants to check for address returned by new, he must call nothrow version of new which should be provided by the library.
There is also placement new, which is a must have tool for writing containers, such as circular buffer.
You can find correct implementation of them in uClibc++
https://github.com/kibergus/StandardCplusplus
Some additional information, why terminating program from new is a good solution is here:
http://kibergus.su/en/node/92
Thanks.
The text was updated successfully, but these errors were encountered: