aboutsummaryrefslogtreecommitdiff
path: root/cores/arduino/new
AgeCommit message (Collapse)Author
2020-09-17Use std::size_t in new/deleteMatthijs Kooijman
The standard dictates that `std::size_t` is used, rather than the plain `size_t` type. Even though these types are usually, if not always, exactly the same type, other code might assume that `std::size_t` is actually used and thus also available under that name after including `<new>`. This fixes that by using the right type. One challenge is that it is usually declared in headers that we do not have available, so this just defines the `std::size_t` type in the `<new>` header to work around that.
2020-09-17Allow overriding selected operator new and delete functionsMatthijs Kooijman
This makes these functions weak, so that a sketch or library can replace them. This does not apply to all of these operators, only for the ones that the C++ standard specifies as replaceable.
2020-09-17Clean up and complete `<new>` headerMatthijs Kooijman
This makes this header complete up to including C++14, except two exception classes that cannot be defined without `<exception>`. The functions related to the "new_handler" are declared but not actually defined, to prevent overhead and complexity. They are still declared to allow implementing them in user code if needed. This makes the implementation of all operator new and delete functions comply with the C++11/C++14 specification in terms of which should be actually implemented and which should be delegate to other functions. There are still some areas where these implementations are not entirely standards-compliant, which will be fixed in subsequent commits. This fixes part of #287 and fixes #47.
2020-09-17Swap new and new.h header filesMatthijs Kooijman
Originally, the Arduino core used "new.h", rather than the standard "new", probably because the implementation was incomplete, and for the most commonly used new and delete operators, no include is needed at all (they are defined implicitly by the compiler). However, now Arduino does expose the "new" name, as an alias for the older "new.h". Given that the standard name is "new", it makes more sense to put the actual content in "new", and make "new.h" a compatibility header that includes "new" instead of the other way around.
2020-05-13Add "new" proxy header for compatibility with c++-standard #include<new>eudoxos