Designing Your Software for Cross-Platform Use
In a computing world that's increasingly heterogeneous, it becomes more important by the day to design your software from the ground up so that it can be "easily" ported to more than one platform. Easily is in quotes above because building cross-platform software is an immense job. However, once it's done, you end up with far more than the sum of the individual parts.
Such a task involves a number of different considerations. These are just the major issues:
Sticking with standards
Selecting languages that work equally well across platforms
Learning how to build an abstraction layer to take advantage of code that need not be specialized for a single environment
Taking full advantage of the strengths of each of the platforms on which the software must run
Many programmers who learned on a specific platformor with a particular compilermay not even be aware that their code is not standards-compliant. Take C and C++, for example. Both C and C++ are languages that have standard implementations (ISO ANSI C and C++), just like many networking protocols do. The problem comes when compiler manufacturers follow a policy of "embrace and extend," where they introduce features to the language to create their own versions of C and C++. Later, when you try to take code built for this compiler and build it under another compiler on the same platform, or on another platform that doesn't have a version of the original compiler available, you discover that some sections of code must be replaced.
You can avoid this problem by either purchasing a copy of the ISO ANSI C or C++ standardswhich some compare to reading legal documents, fairly dry stuff that you must figure out on your ownor purchasing a well-recommended book on C or C++, which likely highlights the nonstandards-compliant features, especially in its reference section. Once you know which functions are ANSI-compliant and which aren't, you have to exercise restraint to avoid those that are non-compliant, even when they offer a significant convenience. Of course, if you want extended functionality that will work under any compiler, you can use the existing ANSI-compliant functions to create new functions of your own. This is a handy way to avoid having to reinvent the wheel.