6.2. General DifferencesWith major operating systems such as HP-UX, Solaris, AIX, and Linux embracing standards set forth by standards bodies such as ANSI, ISO, and POSIX, it would seem that porting between platforms should be easy. When it comes to application programming interface (API) implementation, these operating systems have implemented the majority of the standard APIs from the different standards bodies. From a compiler standpoint, these operating systems support the latest compiler standards, too. Unfortunately, other factors such as programming syntax (brought about by the use of old compilers implementing draft standards), use of platform-specific APIs, and use of early releases of third-party libraries, to name a few, may prevent an easy migration of software applications from HP-UX to Linux. 6.2.1. C LanguageBoth the HP-UX C compiler and GCC support ANSI C, but syntax and semantics differences may still prevent an error-free compilation in Linux. Within GCC, other standards can be selected by using the -ansi, -std=89, -std=iso9899:1990, -std=c99,[3] or -std=iso9899:1999 options.
6.2.2. C++ LanguageStarting with GNU g++ version 3.4.0, GNU g++ claims[4] to be much closer to the ISO/ANSI C++ standards. This means, among other things, that a lot of invalid constructs that used to be accepted in previous versions will now be rejected. HP's aC++ compiler implements ANSI C++ standards and also claims to implement them more completely. The HP-UX C++ compiler ships with the standard C++ and Roguewave STL library and Tools.h++, whereas GNU only ships with libstdc++. Overall, there should be minimal differences in standards compliance when migrating from the latest version of HP-UX aC++ to GNU g++.
6.2.3. GNU C/C++ LanguageThe GNU Compiler Collection (GCC) is available for HP-UX 11i. Applications compiled with GCC on HP-UX will make porting and migration easier on Linux. Take care when using different versions of the GCC compiler when migrating from HP-UX to Linux. Applications that compile cleanly on older versions of GCC might not compile as well on new versions because of changes in programming standards specifically in the C++ language. 6.2.4. Java LanguageThe HP-UX SDK for the Java platform provides the Java 2 (version 1.4) programming tools and runtime environment. The Java environment is available for Linux through the Blackdown Java SDK (www.blackdown.org). As of this writing, Blackdown has released Java version 1.4.2 and is working on release version 1.5. Other Linux Java SDKs are available for download from the Sun and IBM Web sites. Refer to Chapter 2, "Scoping," for more information about the Java environment in Linux. 6.2.5. ThreadsHP-UX 11i v2 supports the POSIX threads implementation. Previous versions of HP-UX supported what is known as CMA threads, which are also known as DCE pthreads. Applications using HP-UX CMA threads will need some major changes to use POSIX threads on Linux. 6.2.6. Standards ComparisonAlmost all Linux distributors acknowledge the value that standardization and portability provide, and they work with the various Linux implementers/maintainers to meet those standards. The primary Linux industry standard is the Linux Standard Base (LSB), which is a project overseen by the Free Standards Group (FSG). The LSB is based heavily on the IEEE POSIX and Open Group Single UNIX Specification standards, but it also documents those places where Linux is not UNIX- or POSIX-compatible. Most and all of the major Linux distributors have certified to the LSB. The LSB, in addition to providing a source code API specification, provides an Application Binary Interface (ABI) specification for each of several common Linux hardware platforms.[5] The goal of the ABI is to ensure binary portability, for LSB-portable applications, between Linux distributions on that hardware platform. Distributors must certify to the ABI as well as the API. Independent software vendors (ISVs) can also certify their applications as "LSB portable" using tools provided by the FSG.
Table 6-1 compares HP-UX-supported standards to the Linux-supported standards based on the LSB specification version 2.0.1.
Although there is standardization within Linux, Linux itself is not totally compliant with either the IEEE POSIX or Open Group SUS specifications.[9] This means that applications that may be totally portable under these common commercial UNIX standards may still need some work to move successfully to Linux. However, this work will be much less than for an application that meets no standards at all, or that uses HP-UX-specific UNIX extensions.
|