Strange problem with delete with VS 2012.

Started by
12 comments, last by BitMaster 10 years, 10 months ago

Secondly, a sadly high number of 'C++ programmers' have decided to call themselves that after reaching the 'C with classes' state and never evolved from there.

That, sadly, describes me. However, I am working to rectify that.

I implemented smart pointers in my code in just a few minutes and I have to say that I like them. Once I got past the weird initialization, compared to just calling new on a raw pointer, it actually makes sense and is much more convenient than raw pointers.

Advertisement

Secondly, a sadly high number of 'C++ programmers' have decided to call themselves that after reaching the 'C with classes' state and never evolved from there.

Sadly, there is now also a breed of programmer who have learned that "a raw pointer is a bug in progress", but only learned to use a single smart_ptr class.

It bugs me no end to see an externally-reference-counted smart pointer implementation being used to scope non-shared instance variables...

Tristam MacDonald. Ex-BigTech Software Engineer. Future farmer. [https://trist.am]

Secondly, a sadly high number of 'C++ programmers' have decided to call themselves that after reaching the 'C with classes' state and never evolved from there.

Sadly, there is now also a breed of programmer who have learned that "a raw pointer is a bug in progress", but only learned to use a single smart_ptr class.

It bugs me no end to see an externally-reference-counted smart pointer implementation being used to scope non-shared instance variables...

That is what I was originally thinking and one reason that I did not use smart pointers. The class and associated member pointer is not shared. However, I suppose this is the purpose of unique_ptr, which is what I used when I converted my code to use smart pointers.

Raw pointers are not evil, they just complicate memory management. In fact, I would say this push towards using smart pointers in exclusion to raw pointers is creating a generation of programmers that do not understand how to do proper memory management, i.e., the compiler does it for me, so why should I care how to do it?

Sadly, there is now also a breed of programmer who have learned that "a raw pointer is a bug in progress", but only learned to use a single smart_ptr class.

It bugs me no end to see an externally-reference-counted smart pointer implementation being used to scope non-shared instance variables...

Well, pre-C++11 there was not really a good way to deal with non-shared managed pointer. std::auto_ptr was not up to the job in most cases. boost::scoped_ptr was noncopyable (although swappable) which made quite a few potential uses annoying and/or awkward.

I'm a bit disappointed though that something like boost::intrusive_ptr didn't make it into C++11.

This topic is closed to new replies.

Advertisement