diff options
author | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2021-07-20 07:24:07 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2021-07-23 11:22:43 -0700 |
commit | f142e9a9c6ba493c09a282544da8715b3656648e (patch) | |
tree | 8b419cad550f086022acdc175a7cc7dd65e7f1e2 /desktop-widgets/printer.cpp | |
parent | 0c84f369c35bf416071b9ef6d5a401b457fd4a38 (diff) | |
download | subsurface-f142e9a9c6ba493c09a282544da8715b3656648e.tar.gz |
core: C++-ify membuffer
C-style memory management is a pain and nearly nobody seems to get
it right. Add a C++-version of membuffer that frees the buffer
when it gets out-of-scope. Originally, I was thinking about
conditionally adding a constructor/destructor pair when compiling
with C++. But then decided to create a derived class membufferpp,
because it would be extremely confusing to have behavioral change
when changing a source from from C to C++ or vice-versa.
Also add a comment about the dangers of returned pointer: They
become dangling on changes to the membuffer.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'desktop-widgets/printer.cpp')
0 files changed, 0 insertions, 0 deletions