Isn't legacy fun? The following four conditional statements all do the same thing...
# if defined(HAVE_GETPT)
pfd = getpt ();
# elif defined(HAVE_POSIX_OPENPT)
pfd = posix_openpt (O_RDWR | O_NOCTTY);
# else
# ifdef _AIX
pfd = open ("/dev/ptc", O_RDWR | O_NOCTTY, 0);
# else
pfd = open ("/dev/ptmx", O_RDWR | O_NOCTTY, 0);
# endif
# endif
In order to support multiple (legacy) systems, we need all of the four conditional statements in the example above. I want to point out the consequences of supporting multiple systems in what testing is concerned. Since we have four possibilities, we have to test four times everything else we had to test before. And we have to compile the program with all possible flags and even test it on different platforms. In some cases, we might even need different hardware.
And at the end of the day we wonder why open-source software, for example, an application for processing video and audio, cannot compete with commercial software. How could it, if open-source developers spend their time accommodating legacy systems and testing different platforms instead of developing new features?
This is just an excerpt and a small example. But this is real code and other examples exist, which are too big for a post.
Tags: programming