Thursday, November 25, 2010 12:10:15 AM
Many people misunderstand the concept "portability." Some people think portability is about Posix conformance. That isn't portability, that's Posix conformance which is a system dependency, even though it's a family of systems. Other people think they are writing portable code when they write for "all versions of Windows." Yet other people think portability is about CPU independence and publish G5, IA32 and amd64 binaries of their OS X applications.
True portability of an application is about the ease of which it is ported from one system to another. It is not about standard conformance or lowest common denominator of some target platforms.
Here is an application specific system abstraction in C++ that is truly about portability and does not pollute the translation unit with implicitly included system headers.
Wednesday, November 10, 2010 11:42:00 AM
Error handling, when calling system calls, is often overlooked. It bloats the code and most of the time it's never run.
The price of writing good error handling code is simply too much for something that may never happen. Worse, even when present it may never have been tested, allowing subtle bugs to lurk for years or even decades.
Here we present a little (incomplete) template library to wrap Posix calls with a posix_call<> template that allows optimum code generation.