Reply to post: Re: Well...

helloSystem: Pre-alpha FreeBSD project chases simplicity and elegance by taking cues from macOS

karlkarl Silver badge

Re: Well...

The problem is if the unique_ptr containing the statement object gets dropped *after* the unique_ptr containing the sql connection object you get a double delete. C is more than capable of stripping out the underlying data from under the smart pointers nose.

Holding onto your local data is only part of the challenge. I spend so much time crafting smart pointers in a way that they also hold onto their parent references up the hierarchy to stop them dropping in order to make things safe.

Chuck some callbacks in the mix and some already awkward deletion strategies and you have lots of fun. This issue is purely because our middleware doesn't provide proper C++ bindings of course ;)

POST COMMENT House rules

Not a member of The Register? Create a new account here.

  • Enter your comment

  • Add an icon

Anonymous cowards cannot choose their icon

Biting the hand that feeds IT © 1998–2021