Features and benefits
With the IBM OS/390 C/C++ compilers, you can produce high-performing OS/390-based applications, and give your customers optimum software business solutions.
Common C/C++ Compiler features
IBM OS/390 C/C++ provides the following features, common to both compilers:
1. OS/390 UNIX System Services (OS/390 UNIX) support, including the use of the OS/390 UNIX Hierarchical File System (HFS) for storage of compiler source and output. (OS/390 UNIX was formerly known as OpenEdition.) The OS/390 UNIX Shell and Utilities feature provides the c89 and cxx commands for invoking the OS/390 C/C++ compilers, the Language Environment Prelinker, and the system binder.
2. Coded character set (code page) support; the compiler can process C and C++ syntax characters (such as square brackets) regardless of which Latin-1 EBCDIC coded character set is used to create the source file.
3. DSECT Conversion Utility for converting descriptive data produced by the High Level Assembler licensed program into OS/390 C/C++ data structures, for OS/390 C/C++ programs that interface with assembler programs.
4. DLL support for generating Dynamic Link Libraries (DLLs) similar to the way Windows® DLLs are generated. DLLs allow a function call or a variable reference in one load module to use a definition located in another load module at run time. DLL support is also available in the OS/390 UNIX environment.
5. Full program reentrancy for OS/390 C/C++ programs.
6. Interlanguage calls between OS/390 C and OS/390 C++ programs, and between OS/390 C or OS/390 C++ programs and assembler, COBOL, PL/I or FORTRAN programs.
7. Language Environment preinitialized interface support for greater efficiencies when invoking a C or C++ program repeatedly from a PL/I or assembler program.
8. Longname support so external names can be mixed case and up to 1024 characters long.
9. Optimization of C and C++ code, using the OPT compiler option, in which the compiler changes unoptimized or inefficient code sequences. This includes such things as:
Inlining, or replacing of certain function calls with the actual code of the function being performed
Value numbering, which involves local constant propagation, local expression elimination, and folding several instructions into a single instruction
Straightening, which rearranges program code to minimize branch logic, and combines physically separate blocks of code
Common (or duplicate) expression elimination
Code motion, or performing calculations outside a loop (if the variables in a loop are not altered within that loop) and using the results within that loop
Strength reduction, in which less efficient instructions are replaced with more efficient ones
Constant propagation, where the compiler combines constants used in an expression and generates new ones
Instruction scheduling, where the compiler reorders instructions to minimize program execution time
Dead code elimination, where the compiler eliminates code for calculations that is not required
The compiler also performs both intraprocedural and interprocedural analysis. Intraprocedural analysis is a mechanism for performing optimization for each function in a compile unit, using only the information available for that function and compilation unit. Interprocedural analysis is a mechanism for performing optimization across function boundaries. You can invoke interprocedural analysis by using the IPA compiler option. It performs optimizations that are not otherwise available with the C/C++ compiler.
10. C/C++ support for the OS/390 UNIX environment, allowing application developers to use C or C++ to build OS/390 UNIX applications.
11. National Language Support to allow dynamic switching between English and Japanese messages.
The OS/390 C Compiler
In addition to the features common to OS/390 C and C++, the OS/390 C compiler provides you with the following capabilities:
All elements of the ISO standard ISO/IEC 9899:1990 (E)
ANSI/ISO 9899:1990[1992] (formerly ANSI X3.159-1989 C)
X/Open Specification Programming Language Issue 3, Common Usage C
FIPS-160
1. System programming capabilities, which let you use z/OS C in place of assembler
2. Additional optimization capabilities through the INLINE compile-time option
3. Extensions of the standard definitions of the C language to provide programmers with support for the z/OS environment, such as fixed-point (packed) decimal data support
The OS/390 C++ Compiler
The OS/390 C++ compiler offers exception handling and template support consistent with the IBM VisualAge C++ family, including C and C++ Compilers for AIX V3.6.6. Exception handling coordinates program flow when unexpected error conditions occur so that they can be dealt with more effectively. Templates define families of related classes or functions. They can be used to construct individual classes or functions so code can be reused.
The OS/390 C++ compiler also offers the Name Demangler (CXXFILT utility), which provides a command-line and library function so that the mangled, or encoded symbolic names, generated by the compiler can be mapped to the original source.
C and C++ Industry Standards
When used with OS/390 UNIX Sytem Services and OS/390 Language Environment, the OS/390 C/C++ compilers provide support for the following standards at the system level:
A subset of the extended multibyte and wide character functions as defined by the Programming Language C Amendment 1, which is ISO/IEC 9899:1990/Amendment 1:1994(E)
ISO/IEC 9945-1:1990(E)/IEEE POSIX 1003.1-1990
A subset of IEEE POSIX 1003.1a, Draft 6, July 1991
IEEE Portable Operating System Interface(POSIX) Part 2, P1003.2
A subset of IEEE POSIX 1003.4a, Draft 6, February 1992 (POSIX.4a has been renumbered to POSIX.1c)
X/Open CAE Specification, System Interfaces and Headers, Issue 4 Version 2
X/Open CAE Specification, Network Services, Issue 4
The C/C++ compilers also provides locale-based internationalization support derived from the IEEE POSIX 1003.2-1992 standard and from the X/Open CAE Specification, System Interface Definitions, Issue 4 and Issue 4 Version 2.
The OS/390 C Compiler also allows you to write portable code conforming to the following standards:
All elements for the ISO standard ISO/IEC 9899:1990(E)
ANSI/ISO 9899:1990[1992]
The OS/390 C++ Compiler also provides an implementation based on the definition of the language contained in the Draft Proposal International Standard for Information Systems-Programming Language C++(X3J16/92-00091).
Documentation
The OS/390 C/C++ product offers references for the C and C++ compilers and utilities, the C/C++ library, the IBM Open Class Library, and the Debug Tool. Displayable BookManager (softcopy) versions of most publications are available on CD with the IBM Library Omnibus Edition: OS/390 Collection (SK2T-6700) and from a tape available with OS/390.
Versions History
OS/390 Version 2 Release 10 C/C++
The OS/390 V2R10 C/C++ Compilers are also an element of z/OS V1R1. For this release, OS/390 C/C++ includes the following performance and usability enhancements:
Extra Performance Linkage (XPLINK)
XPLINK is a new call linkage between functions that has the potential for a significant performance increase when used in an environment of frequent calls between small functions. XPLINK makes subroutine calls more efficient by removing nonessential instructions from the main path. When all functions are compiled with the XPLINK option, pointers can be used without restriction, which makes it easier to port new applications to S/390.Generalized Object File Format (GOFF)
GOFF is the strategic object module format for S/390. It extends the capabilities of object modules to contain more information than current object modules. It removes the limitations of the previous object module format and supports future enhancements. GOFF makes re-binding easier and more efficient. It is required for XPLINK.IPA Level 2
Under IPA Level 1, many optimizations such as constant propagation and pointer analysis are performed at the intraprocedural (subprogram) level. With IPA Level 2, these optimizations are performed across the entire program, which can result in significant improvement in the generated code.Addition of @STATIC Map into Compiler Listing
The @STATIC Map displays offset information for file scope read/write static variables.
This release introduces the following new compiler option:
COMPACT
During optimizations performed during code generation, for both NOIPA and IPA, choices must be made between those optimizations which tend to result in faster but larger code and those which tend to result in smaller but slower code. The COMPACT | NOCOMPACT option controls these choices. When the COMPACT option is used, the compiler favors those optimizations which tend to limit the growth of the code. This feature gives you the flexibility to choose between faster but larger code or slower and smaller code.
The IBM System Object Model (SOM) is no longer supported in the C++ compiler and the IBM Open Class Library. The SOM-enabled class library DLLs have been stabilized at the V2R9 level and continue to be shipped as a run-time environment only. You cannot use the V2R10 Compiler to build SOM applications.
The Model Tool is no longer available.
The option_override #pragma directive defines function-specific options that override those specified by the command line options when performing optimization for code and data in that subprogram. This enables finer control of program optimization. In V2R10 we add support for the COMPACT and SPILL options. The subprogram-specific SPILL option is not a new option, however, the maximum spill area size has been increased for this release to 1073741823 bytes or 230-1 bytes.
OS/390 Version 2 Release 9 C/C++
OS/390 Release 9 introduces the following compiler options and sub-options:
AGGRCOPY
Instructs the compiler whether the source and destination assignments of structures can possibly overlap. (They cannot overlap according to ANSI Standard C rules.) The compiler can generate faster code if source and destination can never overlap. For more information on the AGGRCOPY option, see the OS/390 C/C++ User's Guide.CHECKOUT (CAST)
The CHECKOUT option (C-only) has been enhanced to include a CAST sub-option. This sub-option checks for the potential violation of ANSI type-based aliasing rules in explicit pointer type castings. For more information on the CHECKOUT option, see the OS/390 C/C++ User's Guide.COMPRESS
Suppresses the generation of function names in the function control block, thereby reducing the size of your application's load module. For more information on the COMPRESS option, see the OS/390 C/C++ User's Guide.CVFT
The CVFT option preserves the ANSI C++ behavior of constructors that call virtual functions within a class hierarchy that uses virtual inheritance. The NOCVFT option benefits your application's performance by shrinking the size of the writeable static area (WSA). It may reduce the size of construction virtual function tables (CVFT), which in turn reduces the load module size. For more information on the CVFT option, see the OS/390 C/C++ User's Guide.DIGRAPH
The DIGRAPH option is now supported for C as well as C++. For details on using this sub-option, see the OS/390 C/C++ User' s Guide.IGNERRNO
Informs the compiler that your application is not using errno to check for error conditions. Specifying this option allows the compiler to explore additional optimization opportunities for certain library functions. For details on using this option, see the OS/390 C/C++ User's Guide.INITAUTO
Directs the compiler to generate code to initialize automatic variables. Automatic variables are ones that require storage only while the functions in which they are declared are active. For details on using this option, see the OS/390 C/C++ User's Guide.
This option is intended as a debugging aid, for cases when you suspect that an uninitialized automatic variable is causing problems. You should not specify INITAUTO in production code, because it would almost certainly reduce performance.PHASEID
Specifies that each compiler component (phase) issues an informational message as the phase begins execution. Use the PHASEID option to assist you with determining the maintenance level of each compiler component (phase). For details on using this option, see the OS/390 C/C++ User's Guide.ROCONST
Informs the compiler that the const qualifier is respected by the program. Variables defined with the const keyword are not overridden by a casting operation. For details on using this option, see the OS/390 C/C++ User's Guide.ROSTRING
Allows the compiler to place string literals into read-only memory. When you compile the program with the RENT option, such string literals are not placed into the Writeable Static Area (WSA). This reduces the memory requirement for DLLs. This option has the same effect as the #pragma strings(readonly) directive. For details on using this option, see the OS/390 C/C++ User's Guide.STRICT_INDUCTION
Tells the compiler that induction variables may overflow during normal program operation. NOSTRICT_INDUCTION enables some additional optimization of induction variables smaller than machine registers, by stating that overflow will not occur. For details on using this option, see the OS/390 C/C++ User's Guide.TARGET
The TARGET option has been extended so you can specify selected OS/390 releases as the target for your program's object module. This enables you to generate code that is backward compatible with earlier levels of the operating system. You can compile and link an application on this level of the operating system and run the application on a lower level OS/390 system. This facility is also available on OS/390 V2R6 through PTF UQ90002 and UQ90003. For details on using this option, see the OS/390 C/C++ User's Guide.
OS/390 C/C++ has also introduced the following #pragma directives:
leaves
Specifies that a named function never returns to the instruction following the call to that function. This pragma provides information to the compiler that enables it to explore additional opportunities for optimization.option_override
Directs the compiler to optimize functions at different optimization levels than the one specified on the command line by the OPTIMIZE option. With this pragma directive, you can leave specified functions unoptimized, while optimizing the rest of your application.reachable
Specifies that you can reach the instruction after a specified function from a point in the program other than the return statement in the named function. This pragma provides information to the compiler that enables it to explore additional opportunities for optimization.
For details on how to use these #pragma directives, see the chapter on Preprocessor Directives in the OS/390 C/C++ Language Reference.
OS/390 Version 2 Release 6 C/C++
The OS/390 V2R6 C/C++ Compilers are also an element of OS/390 V2R7 and OS/390 V2R8.
We have made the following enhancements and changes for OS/390 Release 6:
TARGET(OSV1R2) Compiler Sub-option
The TARGET(OSV1R2) sub-option that is provided with OS/390 V2R6.0 C/C++ enables you to generate object code that will run under OS/390 V1R2.0 and subsequent releases.IEEE Binary Floating-Point Support
Added support for the Institute of Electrical and Electronics Engineers (IEEE) binary floating-point data type, in conformance with the IEEE 754 standard, as applicable to the S/390 environment. For details on the OS/390 C/C++ support, see the description of the FLOAT option in the OS/390 C/C++ User's Guide. In addition, two related sub-options have been introduced, ARCH(3) and TUNE(3). The two sub-options support the new G5 processor architecture, and IEEE binary floating-point data. Refer to the ARCHITECTURE and TUNE compiler options in the OS/390 C/C++ User's Guide for details.
Complete IEEE binary floating-point support for OS/390 and its elements requires that you apply small programming enhancements (SPEs) to OS/390 V2R6.0, and to specific releases of some software. These SPEs are delivered as program temporary fixes (PTFs). Consult your System Programmer to ensure that the SPE PTFs you require for IEEE binary floating-point support, as documented in the OS/390 Planning for Installation publication, are applied to your system. The OS/390 Planning for Installation publication documents the complete software requirements for IEEE binary floating-point support on OS/390.Improved the performance of the Binary Coded Decimal (BCD) class library
Compatibility with the decimal data type in C, and other S/390 languages is also improved. For details, see Using the C++ Decimal Data Type in the OS/390 C/C++ Programming Guide.Added support for the long long integer data type.
For more details, see the sections on integer declarations in the OS/390 C/C++ Language Reference. The run-time library, including functions such as printf() and scanf(), does not support the long long data type at this time.Added a new compiler option, PORT.
This option lets you increase the syntax checking for the #pragma pack directive in your code. This option is helpful when porting code that contains #pragma pack directives or packed data from other platforms. For more information on the PORT option, see the OS/390 C/C++ User's Guide.Added a new compiler option, FASTTEMPINC.
This option lets you improve your compilation time for C++ class templates if you use a large number of recursive templates in an application. For more information on the FASTTEMPINC option, see the OS/390 C/C++ User's Guide.Retroactive to OS/390 Version 1 Release 3, the IBM Open Class Library is licensed with the base operating system.
This enables applications to use this library at run time without having to license the OS/390 C/C++ compiler feature(s) or to use the DLL Rename Utility.Changes to optimization options
The level of optimization you get when you specify the OPT(1), or OPT, compiler option is the same as when you specify OPT(2). For more information on the OPTIMIZATION option see the OS/390 C/C++ User's Guide.The OS/390 C++ class library header files are now distributed in the hierarchical file system (HFS) in directory /usr/lpp/ioclib/include.
As part of the name change of OpenEdition to OS/390 UNIX System Services, occurrences of OpenEdition have been changed to OS/390 UNIX System Services or its abbreviated name, OS/390 UNIX, throughout the OS/390 C/C++ information library. OpenEdition may continue to appear in messages, panel text, and other code locations.
OS/390 Version 2 Release 4 C/C++
The OS/390 V2R4 C/C++ Compilers are also an element of OS/390 V2R5.
We have made the following enhancements for OS/390 Release 4:
Performance improvements in the handling of Dynamic Link Libraries (DLLs)
You can use DLLs to split applications into smaller modules and improve system memory usage. DLLs also offer more flexibility for building, packaging, and re-distributing your applications.New option for changing the assumed codepage for character string literals
With this option, you can automatically convert literal character strings in source programs to a specified codepage. For example, at compile-time, programmer-supplied EBCDIC literals can be converted to ASCII for use with ASCII clients.Enhancements to procedures and REXX execs
These enhancements take advantage of the new facilities offered in OS/390 Version 2 Release 4 by the DFSMS/MVSdfp Program Management Binder (Binder)
The Binder combines object modules, load modules, or program objects comprising a C/C++ application and produces a single program object that can then be loaded for execution. Longname usability has also been improved. Longnames appear in the binder maps allowing for full cross-referencing.Introduction of a graphical, interactive source level C/C++ Remote Debugger
The Remote Debugger includes a graphical interface that provides developers with remote access to debugger support from a workstation. You can obtain additional information from the OS/390 C/C++ Productivity Tools web page.Introduction of a C/C++ Performance Analyzer
The Performance Analyzer is a tool that helps users profile their applications to aid in understanding and improving the performance of their programs. This tool traces the execution of a program on the host and creates a trace file. The trace file contains data that can be displayed in diagrams on a workstation to assist the user in performance tuning, examining occurrences that produce faults and in general, understanding what happens when a program runs.
This graphical interface provides users with profiling support from a workstation. You can obtain additional information from the OS/390 C/C++ Productivity Tools web page.
OS/390 Version 2 Release 3 C/C++
We have made the following enhancements for OS/390 Release 3:
- Interprocedural Analysis using the IPA compile-time option is now available for C++ as well as C. This option instructs the compiler to collect information about all of the compilation units in your program, and perform optimizations across the program as a whole.Using the IPA option can improve the execution time of your C/C++ applications.
- The OPTIMIZE(2) compile-time option is now available for C++ as well as C. This option instructs the compiler to perform global optimizations to produce faster running code.
- All libraries in the IBM Open Class Library, excluding the cross-language SOM version of the Collection Class Library, are now thread-safe. This feature allows you to use the class libraries in a multi-threaded environment. Multi-threading offers you the advantages of multi-processing by scheduling tasks independently.
- In addition, the Application Support Class Library includes the following enhancements:
The Notification Framework classes are now available, to provide a process-wide mechanism for the propagation of change information amongst classes.
Internationalization support has been enhanced, to allow for culture-sensitive behavior of character data and formatting of date and time data according to the locale defined at run time.
The ITimeStamp class is now available, to record event occurrences with a combined date and timestamp.
