Nearly a month went by, and no posts. Time does fly...
Although I've been busy with other tasks, C++ has been getting as much of my attention as I can spare. A few notes...
- I've been "designing-as-I-go" on my pet project. I believe this is the best choice when learning something new (I haven't touched development and C++ for so long, I might as well call it "something new"). However, there is a point when this "method" exposes its weaknesses. I've just hit that point 2 weeks ago. I've since been redesigning, and spent more time with a pen and a notebook than on the IDE.
- One of the concepts I've began assimilating these past few days is the power of function objects as callbacks-with-a-sideline-in-information-hiding. I'm taking a closer look at Boost::bind and Boost.Function, to see if I actually grok how it works.
- I'm working on a C++ wrapper for libssh2. As usual, instead of attempting to build a comprehensive wrapper, I'm aiming for something relatively simple that suits my needs and can evolve with those needs. These last few days, I've been making sure it's thread-safe; which, BTW, means making sure that OpenSSL is also thread-safe. To summarize, with OpenSSL, we must provide callbacks for locking/unlocking (I'm using boost::mutex); as for libssh2, it doesn't have this kind of granularity, and the best way to use it is to make sure one SSH session can only be accessed by one thread at a time. My initial design included an SSH Controller to serve as an entry point to all SSH functionality, accepting calls and forwarding those calls to the various SSH sessions, but I've changed my mind. SSH Controller will manage a pool of SSH sessions and give an SSH session to whoever requests it; the requester, which is running in its own thread, will then interact directly with the SSH session, and return it to the pool when it's done.
- I've also been having some fun with this:
Regarding this last point, while trying to understand the concepts at work (and I still haven't grasped it, actually), I've also learned about c++filt, a useful tool for demangling C++ names (the best way I've found to work with it is using gcc's -save-temps option and then feed the assembly file to c++filt). And I can't quite understand why no compiler has a switch for emitting the instantiated template code (C++, not assembly) to a temporary file. Or, at least, a listing of instatiated classes/methods/functions, along with info about the point of instatiation.