Unmanaged is being lonely

time to read 2 min | 348 words

For the past week I have been doing quite a bit of work in unmanaged C++. It is mainly a set of small utilities that we need, and they can't have a dependency on anything.

I used to be a big bigot for C++. I understood RAII and shared_ptr, I could read templated code without a hitch and I occationaly even managed to write a program where pointer chasing was optional :-)

Now that I am working in C++ again, I am amazed to find out just how much I forgot, and just how much stuff is just not there.It was so bad that I actually had to do a search for "Hello World C++" just to find the correct syntax to get the application to compile.

I spent a several minutes searching for std::string.split() method. I knew that it had one, but I could find it (never mind the intelli sense story for C++). I slowly dawned on me that I was actually thinking about System::String, and that C++ really does have more than a single string type.

I still remember the high level concepts, but I lost a lot of the instincts that I had for C++.

For instnace, should a method have a return value of std::string, or std::string* ? What is the meaning of each? I had to actually consider the implications of those decisions before I could go on. And don't get me started about having to worry about releasing memory. I need to write some mutli threaded safe code in C++, and just making sure that all the threads are releasing memory appropriately is going to be a huge headache.

But even beyond that, there is the not small issue of needing to remember all the API that I need. It is not just shared_ptr vs auto_ptr, it is simple things like reading a file or consuming XML.

I feel so lonely without the BCL...