Friday 1 February 2013

And.. I'm back!

A long time since the last post. Not only was December a very busy month (as is usually the case with Decembers), but I've also had time for a small vacation, during which I decided to just goof off.

Still, I've since got back to work. What's been happening?
  1. My pet project and its required libs all build on Visual Studio 2012 (Desktop). I've also added my first conditional compilation code, because Visual C++ doesn't have deleted/defaulted methods.
  2. Reviewed existing comments, and added more Doxygen comments. Also added diagrams, after installing graphviz.
  3. Better use of typedefs, especially after a hard-to-notice bug where I used SomeType instead of SomeType& (which also showed me I still have a lot to learn about using gdb on Windows).
  4. Started creating move ctors for my classes. Which led me to replace reference data members with pointer data members, following the advice I got here. Normal use was not broken with these changes. However, move semantics are not yet implemented, and I'll have to investigate/redesign further. More about this soon.
  5. The previous point led me to yet another little problem with boost asio's io_service (did I already mention this class needs some management love?), namely, it's not move constructible. Which, in turn, led me to another redesign, using unique_ptr<io_service>.
Point 3 posed me a bit of a problem, and I'm still on the fence about how I solved it - where to declare these typedefs. I first considered placing the declarations where the actual types are defined - thus, SessionHandleRef would be declared in session_handle.h. However, I couldn't do that for someone else's types - e.g., boost classes. And also, that meant no forward declarations, since I would have to #include the header to use a typedef (I believe this could be solved for my own classes, by creating a header file with the forward declarations and the typedefs).

So, I've switched to declaring typedefs where they're used. As long as I don't redefine the typedef (i.e., don't change its type-declaration), I'll be fine. On the one hand, it fits well with C++'s philosophy of "declare just before use"; on the other hand, it fells a bit disorganized to have the same typedef repeated in several headers (and this is why I'm not so sure about my solution). Still, it's nothing that can't be solved with a bit of search-and-replace, if the need arises.

I'm also setting up a way to make the code available. More on that after I get the move ctors sorted out.

No comments:

Post a Comment