I’ve gotten around and made solid firmware by making sure I only use Preallocated memory. Now I’m in need of using Dynamic memory allocation and I’m a little confused. According to http://www.cplusplus.com/doc/tutorial/dynamic/ one can just add (nothrow) and you’ll not get an error thrown if memory allocation fails. This fails to compile with the error:
'nothrow' was not declared in this scope
I poked around in the Particle firmware and found that nothrow exists, so it’s likely supported. By adding the following to the top of my class, the file compiles as it should:
This looks to be working well, but it would be great if we could add a bit more information to the rather thin portion of the docs that mention dynamic memory allocation. https://docs.particle.io/faq/particle-devices/code-size-tips/photon/#memory-allocated-with-malloc-new-etc-
Anyone got ideas for what I should add apart from the above?