XL C/C++ is a general purpose programming language compiler for IBM® AIX® and Linux platforms, geared toward tool vendors and enterprise business application developers who develop and deploy applications on IBM® Power Systems®. Enhancements introduced in Version 12.1 improve developer productivity and application performance. XL C/C++ continues to offer these advantages:
- Ease application migration through conformance to the latest international programming language standards
- Simplify parallel programming practices through full support for the OpenMP V3.1 API specification
- Provide faster compile time, notably for large applications
- Simplify programming tasks through new options, directives and functions
This article describes the new features and enhancements in XL C/C++ for AIX and XL C/C++ for Linux, Version 12.1. It does not attempt to cover every new feature and function, nor does it attempt to describe every area in great depth. Instead, it introduces you to some of the new areas of XL C/C++ V12.1, starting with the enhancements to support language standards and then moving to parallel programming, debugging optimized code, and performance.
Language standards enhancements
With XL C/C++ V12.1, development and implementation of the features of the latest C++ language standard, ISO/IEC 14882:2011 (also known as C++11), continues.
- The explicit conversion operators feature can be used to inhibit implicit conversions from being applied where they might be unintended, thus allowing you to program more robust classes with fewer ambiguity errors.
- The generalized constant expressions feature extends the expression allowed within constant expressions that can be evaluated at compile time rather than at run time, thereby providing performance benefits.
- The reference collapsing feature allows you to form a reference to a reference type using a
typedefname, or a template type parameter. This feature facilitates generic and template programming.
- The rvalue references feature allows you to reuse the resources of expiring objects. Therefore you can improve the performance of your libraries, especially if you use generic code with class types, such as template data structures. Additionally, you can consider the value category when writing a forwarding function.
- The scoped enumeration feature now gives you the ability to declare a scoped enumeration type, an enumeration without providing enumerators, a type of enumeration, and improved type safety. This feature improves library building and security by providing better type safety. It also improves compile time and creates fewer dependencies with the introduction of forward declarations of enumerations.
- The trailing return type feature is useful when declaring function templates or member functions of class templates with return types that depend on types of the function arguments, function or member functions of classes with complicated return types, and perfect forwarding functions. This feature improves clarity in writing function return types that are complex and that tend to introduce code cluttering.
–qlanglvl=extended0xoption can be used to enable most of the C++ features and all of the currently supported C++11 features in XL C/C++ V12.1.
XL C/C++ V12.1 also starts the multiphase implementation of the latest C language standard, ISO/IEC 9899:2011 (also known as C11). The following C11 features are selected to be supported in this release.
- Anonymous structures allow all members of the anonymous structure to behave as if they were members of the parent structure for easier grouping and nesting.
- Initialization of complex types supports infinite or NaN in the imaginary part. This provides a portable way to initialize complex types with the range of values.
_Noreturnfunction specifier enables you to produce better-performing code by self-documenting that the functions will not return to the caller.
- Static assertions can be declared to check important program invariants. This allows libraries to detect and diagnose common use errors at compile time.
–qlanglvl=extc1xoption can be used to enable the C11 features in XL C/C++ V12.1.
Parallel programming enhancements
OpenMP API is a portable, scalable programming model that offers programmers a simple, flexible standard interface for developing parallel applications for platforms, ranging from the desktop to the supercomputer. XL C/C++ V12.1 delivers full support for OpenMP V3.1, which includes the following features:
- Final and mergeable tasks can provide further optimization opportunities in shrinking computation size scenarios.
- The taskyield construct gives users full control of where a thread can switch from one task to another task.
- Better thread affinity control through the
OMP_PROC_BINDenvironment variable means that you can take advantage of the characteristic of the machine architecture.
- Finer control of the number of threads used in nested parallelism by the
OMP_NUM_THREADSenvironment variable so that you can express how many threads are being used in a team.
- The atomic construct extension (read, write, capture) includes more types of atomic operation to better synchronize parallel code.
Diagnostic report enhancements
The diagnostic reports can help you identify opportunities to improve the performance of your code. With this release, these enhancements were made to the reports:
- Compiler reports highlight the optimizations that the compiler was able to perform, as well as which optimization opportunities were missed but are now available, in both HTML and XML format. The compiler reports in HTML format are ready to be displayed. These reports provide information that can help reduce programming effort in tuning applications.
- New sections have been added to the listing file to help you analyze your programs, including the relevance, missing, and outdated profiling data.
- The showpdf utility is enhanced to show a view of cache-miss and value profiling information. This view of profiling information can help programmers identify possible performance bottlenecks and can lead to improved efficiency of applications.
Compile-time performance and scalability improvements
XL C/C++ Version 12.1 provides faster compile time, notably for large applications. In addition, the use of machine resources is improved by reducing the amount of memory required by the compiler, such as for pointer analysis and alias computation. Header files, which are repeatedly used in applications, are cached within the compiler to speed up overall processing during compile time. The compiler and optimizer use the greater addressability of 64-bit process, thereby allowing significantly larger programs to be optimized.
Options, directives, and functions continue to simplify programming tasks, thus shortening development time and reducing risk.
In this release, a program with multiple threads can use the new built-in functions in XL C/C++ V12.1 to atomically and safely modify data in one thread without interference from another thread. This behavior corresponds to that provided by the GNU Compiler Collection (GCC).
Several compiler options were added or enhanced. For example, the
-g option is extended to improve the debugging of optimized programs. This enhancement allows you to choose between the aggressiveness of some optimizations versus the amount of accurate debug information being produced in the executable program. This approach can allow the compiler to provide debug information without trading off too much in performance opportunities. You can now debug an optimized application with this new enhancement.
-qhaltonmsg option stops the compilation before producing any object files, executable files, or assembler source files if a specified error message is generated. The
-qinfo=all option enables all diagnostic messages for all groups except
ppt. Many suboptions were added to the
-qlanglvl option to support new language standards added this release.
A group of new pragma directives were added to improve loop iterations. The
min_iterations pragmas allow you to provide hints to the compiler about the number of iterations that the loop will execute. This information can further improve the speed of running the program.
This article highlighted some of the more notable enhancements that have been introduced to XL C/C++ Version 12.1. This latest version includes new capabilities related to performance and application development.
- Find out more about XL C/C++ for AIX and Linux:
- Visit the Rational software area on developerWorks for technical resources and best practices for Rational Software Delivery Platform products.
- Subscribe to the developerWorks weekly email newsletter, and choose the topics to follow.
- Stay current with developerWorks technical events and webcasts focused on a variety of IBM products and IT industry topics.
- Attend a free developerWorks Live! briefing to get up-to-speed quickly on IBM products and tools, as well as IT industry trends.
- Watch developerWorks on-demand demos, ranging from product installation and setup demos for beginners to advanced functionality for experienced developers.
Get products and technologies
- Get the free trial download for XL C/C++ for AIX.
- Get the free trial download for XL C/C++ for Linux.
- Try XL C/C++ for IBM AIX by spending a while in the Enterprise Modernization Sandbox.
- Download a free trial version of Rational software.
- Evaluate other IBM software in the way that suits you best: Download it for a trial, try it online, use it in a cloud environment, or spend a few hours in the SOA Sandbox learning how to implement service-oriented architecture efficiently.
- Get connected. Join the Rational C/C++ Café community.
- Join the Rational software forums to ask questions and participate in discussions.
- Ask and answer questions and increase your expertise when you get involved in the Rational forums, cafés, and wikis.
- Rate or review Rational software. It's quick and easy.
Dig deeper into Rational software on developerWorks
Experiment with new directions in software development.
Read and subscribe for the best and latest technical info to help you deal with your development challenges.
Software development in the cloud. Register today and get free private projects through 2014.
Evaluate IBM software and solutions, and transform challenges into opportunities.