Skip to main content

An open source C++ snippet library...

For the past month and a half, I've been delving deep into C++ land, wrestling with the intricacies and annoyances of writing cross-platform code. My biggest gripe with the major libraries out there is that they all have a 'string' class and then proceed to use their 'string' class everywhere, which basically means that if you want to use a specific library, you end up using all of it. I also wanted to push the performance envelope to the limit, which means putting storage on the stack instead of the heap.

At any rate, check it out:

Cross-platform C++ Snippet Library

My favorite class is Sync::TLS, which implements a temporary memory allocator that outperforms system malloc()/free() by a factor of up to 19 times! When I saw the stats, my jaw hit the floor and I drooled a little. It was awesome. I was expecting for Sync::TLS to get crushed soundly.

I'm also rather happy with the little UTF-8 library that's included. A minimalistic Unicode implementation that makes sense, given what I know about Unicode...which is a LOT. It has some really clever conversion tools to get to and from UTF-8 into whatever system calls use (i.e. wchar_t, LPWSTR, etc.) without getting all OS-dependent. The UTF-8 stuff is the only "string" class in the library and I've intentionally severely limited its scope.

The reason I started the library was to have cross-platform, cross-process, named mutexes, semaphores, event objects, and reader-writer lock objects. The 'named' part is critical. Linux is pretty weak as far as named synchronization object support goes, but Windows could use some work as well.

Comments