He then took the independent C++ library groups to task, not for lack of effort, but for failure of consistency. Even within some of the large libraries (like Boost), pieces don't always well work together.
But unfortunately its worse than that.
Maybe I'm just stuck in my ways, but I worry about a lot of low level details. I worry about memory allocations, I worry about buffer overflow attacks. I try to keep a clear eye on system resource use and even kernel calls. So for instance I don't want to turn std::string loose on a socket and let the inbound communication possibly allocate megabytes of memory. I also want to avoid buffer overflow problems, but with a minimum of overhead, so I almost universally refer to messages as buffers which contain a pointer and a size, and I scan through them using smart pointers which check bounds, but use a minimum of overhead:
buffer_scan pscan( abuffer) ; while ( pscan ) { putchar( * (pscan ++)) ; }Other than coming up with a shorter test case for ending, this isn't much different from how you'd scan through data in C. For iterators on lists, I went even closer to historic C syntax:
btl::tlist piter( alist) ; for ( ; piter ; ++ piter ) { dosomething( * piter ) ; }But I don't even know what I'm getting myself into when I call into std algorithms. Does std::sort or std::merge allocate and use extra memory? Or are they entirely in place? As I scale up am I going to need O(n), O(log n) or just a few extra bytes? And if these things worry about multi-threading, do I end up acquiring system locks and other things just to get my 20,000 items in order?
And where are basic things like memory mapping a file? Or how do you the equivalent of a printf("%.1f\n", dtmp) using iostreams? The best I could come up with was cout << 0.1 * ( std::floor( 10 * dtmp)) << std::endl. Ugh.
So while I'm happy to read through the documentation and code for Boost, and see if there's anything cool in Poco, I'm more looking for things I can steal, than libraries I can use. And unfortunately that means I'm not helping move the state of C++ libraries forward very fast. But at least for the projects I work on, the interfaces will be solid and consistent.
Labels: c++, c++11, programming
Feb '04
Oops I dropped by satellite.
New Jets create excitement in the air.
The audience is not listening.
Mar '04
Neat chemicals you don't want to mess with.
The Lack of Practise Effect
Apr '04
Scramjets take to the air
Doing dangerous things in the fire.
The Real Way to get a job
May '04
Checking out cool tools (with the kids)
A master geek (Ink Tank flashback)
How to play with your kids