Write Once, Run Forever
Ed Grochowski
Written 10-21-2018
Updated 1-17-2019
Introduction
In four decades of computer programming as a hobby, I have written a
great deal of software. Initially, I wrote software for my home-built
computers using the Z80 and 68000 microprocessors. In 1995, I switched
to Microsoft's then-new Windows 95 running on personal computers. In
2004, I again switched to GNU/Linux running on personal computers.
Each change required enormous effort to port my software to the new
platform. By now, I have written and maintain hundreds of programs.
These include programs that I use today and programs that I keep for
historical interest.
Portability has become my highest priority. This article looks at the
software tools that I use.
Programming Languages
General Programming - C/C++
For general programming, C and C++ are high-performance and universal.
C++ is a large language with a rich feature set. I find that C++ is
best approached by selecting a suitable subset.
I write most code using the subset of C++ that is C. C++ features are
limited to the use of new, delete, bool, and
const. The C++ const keyword provides real constants,
eliminating much of the need for the preprocessor's #define.
I prefer to code in the procedural style of C using struct to
encapsulate the variables shared by a set of procedures.
I use GCC for my daily builds and occasionally use LLVM to compare
against GCC.
Shell Scripts - Bash
Shell scripts glue together C/C++ programs. They are a convenient way
to create powerful programs with only a few lines of code.
Shell scripts invoke the functionality provided by Bash, the GNU
coreutils, and of course my programs.
Libraries
All Applications - GNU C Library
The GNU C library is universal. This includes the well-known stdlib,
stdio, and math libraries.
Graphical Applications - GTK
GTK provides all the widgets that one would expect in a modern graphical
user interface. GTK's main libraries are gtk, gdk, cairo, pango, and
glib.
I use GTK 2.24 because of its excellent stability and performance.
Graphical user interface descriptions are designed in Glade 3.8 and read
using GtkBuilder.
Icons in PNG and SVG formats are created with Gimp and Inkscape,
respectively.
Multithreaded Applications - Pthread
To utilize multicore processors, computation-intensive programs are
multithreaded. These programs call the Pthread library to create and
synchronize threads. Pthread is now part of the GNU C library.
Operating System
Environment - Slackware Linux
I run Slackware Linux because it is extremely Unix-like. Everything
works like a Unix programmer would expect.
System Calls - POSIX
To access to low-level functionality, I call the operating system using
POSIX system calls. These include stat, lstat,
fork, getpid, and waitpid.
Build System - GNU Autotools
GNU autoconf, automake, and libtool are a build system that works on
many platforms and standardizes the process of configuring, building,
and installing software. The GNU autotools require only small input
files that describe how to configure and build a software package.
Documentation - HTML and Man Pages
Graphical programs have HTML documentation and command-line programs
have Unix man pages.
HTML 4.01 transitional has long been a standard on the world wide web.
I write documentation in HTML 4.01 transitional and view it in the
Firefox web browser.
Conclusion
These software development tools can be expected to remain
forward-compatible. This is possible because they are all standardized,
open-source, and licensed under terms that permit everyone to contribute
to them.
Through judicious choice of tools, I expect that my software will
continue to run for the foreseeable future.
|