Chapter 15. Writing Portable Code and Maintaining Ports

'Legacy code' often differs from its suggested alternative by actually working and scaling.

Bjarne Stroustrup

As I explained in Chapter 1, porting is an attractive option because it can eliminate the need to duplicate code. But with so many platforms, architectures and tools in the market, developers can find it difficult to port from one operating system to another.

The advantages of designing and writing portable code include:

  • operating system flexibility

  • significantly improved time to market for new platforms

  • robust code: porting and testing code on different platforms helps in finding bugs.

Before thinking about how to design your portable code, you have to deal with something even more fundamental: getting the files on to your development host platform. If you target the Symbian platform, Windows Mobile and Linux, you'll probably end up editing your files on different platforms because you'll typically develop for the Symbian platform and Windows Mobile on a Windows machine and for Linux on a Linux machine. Because there is not yet a single-host, multiple-target, integrated development environment to deal with all these platforms, this chapter also covers how to manage your files while using different integrated development environments for writing cross-platform software.

Recognizing Portable Code

Before you write or change a single line of code, you should understand exactly what it is you're trying to do. Porting software is ...

Get Porting to the Symbian Platform: Open Mobile Development in C/C++ now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.