307d0de26ef4a60a30f188e912ab37ecd6bc2c5a
MEM_new_for_free to allow construction of almost-trivial types.
The data constructed by this call remains in the 'C-alloc' realm, i.e. it can be `MEM_dupallocN`'ed, and `MEM_freeN`'ed. This is intended as a temporary API only, to facilitate transition to full C++ handling of data in Blender. It's primary target is to allow pseudo-POD types to use default values for their members. See e.g. !134531. Unlike !143827 and !138829, it does not change the current rule (`new` must be paired with `delete`, and `alloc` must be paired with `free`). Instead, it defines an explicit and temporary API to allow a very limited form of construction to happen on C-allocated data, provided that the type is default-constructible, and remains trivial after construction. ### Notes * The new API is purposely as restrictive as possible, trying to only allow the current known needs (init with default member values). This can easily be extended if needed. * To try to stay as close as malloc/calloc behavior as possible, and avoid the 'zero-initialization' gotcha, it does not use value-initialization, but instead default-initialization on zero- initialized memory. _Ideally it would even not allow any user-defined default constructor, but this does not seem simple to detect._ Pull Request: https://projects.blender.org/blender/blender/pulls/144141
…
Blender
Blender is the free and open source 3D creation suite. It supports the entirety of the 3D pipeline—modeling, rigging, animation, simulation, rendering, compositing, motion tracking and video editing.
Project Pages
Development
License
Blender as a whole is licensed under the GNU General Public License, Version 3. Individual files may have a different but compatible license.
See blender.org/about/license for details.
Description
Languages
C++
78%
Python
14.9%
C
2.9%
GLSL
1.9%
CMake
1.2%
Other
0.9%
