Previous section   Next section

Imperfect C++ Practical Solutions for Real-Life Programming
By Matthew Wilson
Table of Contents
Appendix A.  Compilers and Libraries


A.2. Libraries

Wherever possible, I've tried to use examples that are independent of any particular library. However, as the main author of the STLSoft libraries, I've naturally drawn many examples from that source. In most of those cases, I've attempted to keep their heritage quiet, not through some insincere modesty, but rather because I don't like to read books that are thinly veiled marketing vehicles for the author's own work. This is especially irritating when you're required to ingest a large quantity of substantive and interrelated components to understand each new topic discussed.

I have made the real nature of any libraries clear when I'm comparing implementations in performance terms, since I must facilitate any independent verification of the results that you readers may wish to make. They wouldn't be very trustworthy otherwise.

Other parts come from the libraries of my employer, Synesis Software (http://synesis.com.au/),[1] or from the Boost libraries (http://boost.org/), which is an open-source community of many of the leading names in C++. The remainder are repackaged (to avoid enmity) mistakes I have witnessed in work for various clients, or are plucked from the ether as necessary to illustrate the points.

[1] This code base has been building since my Ph.D. work in 1992–95. As such, there is a lot of unpleasant and arcane stuff in there. If you have significant criticisms of any Synesis code shown in the book or included on the CD, please temper your tendency toward any triumphant bug reporting with the caveat that I probably already know about it, have put it on a to-do list, and have eschewed any reproduction of such affront in any newer software (such as STLSoft). Being a chatty kind of chap I am, of course, happy to hear from you, but you may want to save yourself the effort.

A.2.1 Boost

Boost is the preeminent C++ library of recent times, and contains in its ranks many notable figures in C++. It contains some very powerful components, a massive contributor base, and is already seen as a de facto standard. It is likely that many of the new features of the next release of the standard library will come from Boost.

The Boost libraries are included on the CD, and are also freely available online from the Boost Web site at http://www.boost.org/.

A.2.2 STLSoft

STLSoft started life several years ago as a couple of STL-like sequence containers wrapped around file-system enumeration and Win32 registry APIs. Its libraries have grown steadily over the last few years and now cover a number of technology and operating system areas. Many of the parts of the libraries are derived from proprietary Synesis Software code, so it has a lot of years behind it. The focus of STLSoft is efficiency, robustness, and portability, all the while keeping faith with the rule of 100 percent header-only source. It has fewer members than Boost.

I don't know whether any STLSoft features will make it into the next standard library, but then I've not made that a focus up to this point. One of the reviewers of Imperfect C++ is on the standards committee, and has invited me to make some submissions, so who knows?

The STLSoft libraries are included on the CD, and are also freely available online from the STLSoft Web site at http://www.stlsoft.org/.

A.2.3 Others

There are a few other useful libraries that I think are worth mentioning.

Open-RJ (http://www.openrj.org/) is a small, simple, structured file reader library, for the Record-JAR [Raym2003] format, written by Greg Peet and myself. It's implemented in C, but provides a host of mappings, including C++, D, Ruby and STL. It's a very simple format—the library compiles to less than 5KB—but surprisingly useful.[2]

[2] The Open-RJ website, and the HTML content of the Imperfect C++ CD, was generated by Ruby scripts from Open-RJ content files. It's also used for configuration data for the Arturius compiler multiplexer (see Appendix C).

PThreads-win32 (http://sources.redhat.com/pthreads-win32/) is a GNU library that provides almost all the PTHREADS specification for the Win32 platform. It's extremely useful when you are writing for UNIX and need to work on a Windows machine. Of course, if your laptop dual boots Linux, then you may not need it for that reason, but it can still be useful for writing tools for both platforms with single code sets.

RangeLib (http://www.rangelib.org/) is the home of the Ranges concept, as developed by John Torjo and myself. The Ranges concept is still developing and, along with Boost and STLSoft implementations, it may also slip across to other languages. But we'll have to wait and see on that one (see Epilogue).

recls (http://www.recls.org/)—for recursive ls—is a platform-independent recursive file-system search library of mine that I originally wrote due to constant frustration at endlessly coding the same old boilerplate every time I needed to conduct recursive searches. It has become an exemplar for my C/C++ Users Journal column, "Positive Integration," which describes techniques for integrating C and C++ with other languages and technologies. The library is implemented (using the STLSoft libraries) in C++, but provides a C interface to the outside world (see Chapters 7 and 8). It continues to evolve into other recursive searching areas, and has mappings to COM, D, Java, .NET, Ruby, and STL among an ever-growing list.

zlib (http://www.zlib.org/) is probably the most famous freely available compression library. It's very easy to use, and thankfully accepts external memory allocators (see section 32.3), of which I heartily approve.


      Previous section   Next section