HP aC++/HP ANSI C A.06.
© Copyright 2012 Hewlett-Packard Development Company L.P. All rights reserved Confidential computer software. Valid license from HP required for possession, use or copying. Consistent with FAR 12.211 and 12.212, Commercial Computer Software, Computer Software Documentation, and Technical Data for Commercial Items are licensed to the U.S. Government under vendor's standard commercial license. The information contained herein is subject to change without notice.
Contents 1 HP aC++/HP ANSI C release notes..............................................................6 2 What’s new in this version...........................................................................7 Improved support for C++11 core language features.....................................................................7 New char types char16_t and char32_t..................................................................................7 Alias and alias template declarations........................
Variadic macros ...........................................................................................................20 _Pragma operator ........................................................................................................20 extern template .................................................................................................................20 Decimal Floating Point supported in C++ mode (New)............................................................
__attribute__ ((visibility("default"|"protected"|"hidden"))) Added (New)...................................36 __attribute__ ((warn_unused_result)) Added (New).................................................................36 Change in treatment of cv-qualified assignment operators.......................................................37 New features in version A.06.12...............................................................................................37 +Ofast (-fast) and +Ofaster options........
1 HP aC++/HP ANSI C release notes The information in this document applies to the release of HP aC++ and HP ANSI C compilers for the HP-UX 11i v3 operating system on Integrity servers. The HP ANSI C compiler supports ANSI programming language C standard ISO 9899:1999. HP aC++ compiler supports the ISO/IEC 14882 Standard for the C++ Programming Language (the international standard for C++). HP ANSI C and HP aC++ are distributed as a single software bundle.
2 What’s new in this version HP aC++/HP C compiler version A.06.27 provides additional support for C++11 core language features, with complete binary compatibility with earlier releases and -AA compilation mode. Following are the changes in HP aC++/HP C compiler version A.06.
return 0; } Alias and alias template declarations Alias declarations and alias template declarations are now supported in the C++11 compilation mode.
explicit operator bool(){return true;} }; int main(int argc, char** argv) { A a; (void)bool(a); // Okay if (a) {} // Okay //bool b = a; // Would be an error return 0; } Trailing return types (with "auto") In the C++11 mode the compiler now accepts "trailing return types" in function declarators following an "auto" type specifier. auto f()->int {return 0;} // Same as int f(){...
Improved support for GNU extensions This release of aC++ supports a host of GNU compiler extensions. For more details about these features, refer to the GNU documentation available at http://gcc.gnu.org/onlinedocs/gcc/.
Better support for built-ins Various GNU builtins are now supported in the default compilation mode in this release of aC++, such as __builtin_exit, __builtin_trap, __builtin_vfprintf, __builtin_vfscanf, __builtin_offsetof and GNU macro __COUNTER__. NOTE: More details on the supported GNU features shall be provided in the next release.
3 Product changes in earlier versions New features in version A.06.26 This chapter gives an overview of the product changes in this version of the HP aC++/HP C compiler. HP aC++/HP C compiler version A.06.26 provides leading edge support for C++0x standard language features, with complete binary compatibility with earlier releases and -AA compilation mode. Following are the changes in HP aC++/HP C compiler version A.06.
Unnamed types and static routines are given globally unique names The unnamed classes and enums in namespaces (including the global namespace) as well as static functions are now mangled such that they do not collide with names from other translation units and can be used in the mangled names of template functions.
Improved C++ Demangler The C++ demangler c++filt has been improved to use better algorithms, which are more robust and standard compliant. There are no changes to the external interface. NOTE: __cxa_demangle has not changed in this release. Deprecation and removal of options The following options are deprecated: • -AP In order to enable future runtime library versions, the -AP option is being deprecated and will be removed in a future version of aC++.
• +O[no]loop_block This option is replaced by +O[no]loop_transform. • +Oinline_budget=n This option was deprecated earlier. It is replaced by +inline_level=n. • +O[no]report This option is useful only on PA-RISC systems. • +df This is an option used on PA-RISC systems, and is replaced by +Oprofile=use[:filename]. • +ES[no]lit This is an option used on PA-RISC systems, and is replaced by +Olit=all / +Olit=none.
• ◦ In C++0x mode, auto is always a type specifier, not a storage-class specifier ◦ Lambdas C99 features added to C++0x (New) ◦ Mixed string literal concatenations ◦ Rule changes related to determining the type of large literal constants ◦ Variadic macros ◦ _Pragma operator • extern template • Decimal Floating Point supported in C++ mode (New) • #pragma STDC FLOAT_CONST_DECIMAL64 (New) • #pragma omp task (New) • #pragma omp taskwait (New) • Performance enhancements for +O1 (Changed)
error #3031-D: an entity with internal linkage cannot be referenced within an inline function with external linkage • Use of inline or restrict as variables/functions/types: error #2040: expected an identifier Full -AA default C++ compilation mode (Changed) In this version of the HP aC++ compiler, the default C++ compilation mode has changed to full -AA, which now additionally enables the option -Wc,-ansi_for_scope,on. This is being done to reduce porting efforts by adhering to the C++ Standard.
static_assert static_assert(, ); Support is now included for static_assert, which generates a compile-time error if the integral constant is zero/false. Example: template struct S { static_assert(sizeof(T) > 4, "Type too small"); }; S s1; // Will trigger an error when the static_assert // declaration is instantiated.
Defaulted and deleted functions Deleted functions (= delete;) and defaulted special member functions (= default;) are now supported. A deleted function is a function declaration that cannot be referenced. For example: int f(int) = delete; short f(short); int x = f(3); int y = f((short)3); // Error: selected function is deleted. // Okay. Special member functions that can be implicitly defined can instead be explicitly declared, but with a default definition.
For example: wchar_t *str1 = L"a" "b"; // Okay, same as L"ab". wchar_t *str2 = "a" L"b"; // Okay, same as L"ab" Such constructs were already accepted in C99 and GNU modes. Rule changes related to determining the type of large literal constants As in C99, unsuffixed integer literals that do not fit in type long, but can fit in type unsigned long, are given type long long instead. This might cause certain expressions to differ in values in C++0x and default C++ compilation modes.
extern template class std::vector; Decimal Floating Point supported in C++ mode (New) With this release of the compiler on HP-UX 11.31 systems only, Decimal Floating Point is supported in C++ mode, along with the +decfp option. To use Decimal Floating Point with C or C++ include files you must define __STDC_WANT_DEC_FP__. For C++ you should define __STDC_WANT_DEC_FP__ before including any headers, because some C++ headers might include or indirectly.
#pragma omp taskwait (New) #pragma omp taskwait new-line The OpenMP 3.0 directive #pragma omp taskwait specifies a wait on the completion of child tasks generated since the beginning of the current task. Because the taskwait construct does not have a C language statement as part of its syntax, there are some restrictions on its placement within a program. The taskwait directive may be placed only at a point where a base language statement is allowed.
int i, j; }; A::A(int c): i(++c), j(++c) { } //remark #3719 - Init order is different than //what is apparent from the code above Improved diagnostic messages (Changed) Several improvements have been made in the compiler diagnostic messages in terms of wording, better positioning of error constructs, and removal of redundant diagnostics. Some examples: Warning #2069 is replaced with warning #2767 when appropriate.
• +O[no]dynopt (New) • +inline_level num (Enhanced) • -dumpversion (New) • #include_next (New) • #pragma diag_push (New) • #pragma diag_pop (New) • +Oinlinebudget is deprecated • In next release, default C compilation mode will change from C89 to C99 • In next release, default C++ compilation mode changes to full -AA Decimal floating-point arithmetic (HP-UX 11.31 only) (New) On HP-UX 11.31 systems, support is now included for decimal floating-point arithmetic for C.
encoding". Both encodings provide exactly the same data, analogous to big endian and little endian encodings. • Decimal FP I/O and string conversion. The decimal FP length modifiers for printf() and scanf() floating-point conversion specifiers (a, A, e, E, f, F, g, G) are H for _Decimal32, D for _Decimal64, and DD for _Decimal128. The decimal a, A specifiers for printf(), given no precision or sufficient precision, produce an exact quantum-preserving representation of the decimal FP value being converted.
* This program is intended to illustrate how C decimal FP might be * used in a commercial billing program. * * The program reads input data from a file, interprets each datum * as a number of service minutes, converts to hours (rounding up to * the nearest tenth of an hour), and multiplies by a billing rate * (rounding to the nearest cent with halfway cases rounding away * from zero). For each inputl, the program writes the billing amount * as an ASCII character string to a file.
} // initialize sums sumM = 0.DD; sumH = 0.0DD; sumB = 0.
printf(" printf(" total hours billed total amount billed = %Da\n", sumH); = %Da\n", sumB); return 0; } Notes: • The quantize functions do the work of rounding to the desired number of places to the right of the decimal point. They return the value of their first argument represented with the quantum exponent of their second argument, rounding if necessary. • Mixing decimal FP and integer operands, as in the expression m / 60, is allowed. However, the expression m / 60.
+O[no]dynopt (HP-UX 11.31 only) (New) On HP-UX 11.31 systems, the +O[no]dynopt option enables [disables] dynamic optimization for the output file. Both forms of this option change the default setting, which allows the run-time environment to enable or disable dynamic optimization according to a system-wide default. This option applies only to executable files and shared libraries, if the run-time environment supports this feature.
In next release, default C compilation mode will change from C89 to C99 In the next version of the HP C/aC++ compiler, the default C compilation mode will change from C89 to C99. So cc -Ae or aCC -Ae will be the same as -AC99, and C99 features will be enabled. Users can prepare for this transition by adding -AC99 to their build options and addressing any issues.
• +Wv Option (New) • +wlock Option (New) • +O[no]autopar Option (New) • +O[no]loop_block Option (New) • +O[no]loop_unroll_jam (Default Changed) • +Olit=all is the new default for HP C (Change) • +macro_debug= Option (New) • +pathtrace Option (New) • +check Suboptions (New) • -Bhidden_def Option (New) • -dM Option (New) • #pragma OPT_LEVEL INITIAL (New) • #pragma OPTIMIZE (Deprecated) • #pragma [NO]INLINE (New for C++ mode) • _Asm_ld, _Asm_ldf, _Asm_st, _Asm_stf intrinsics added
and indicating the number of contexts omitted. The default value for num is 5. A value of 0 removes the limit. +wperfadvice option (New) +wperfadvice[={1|2|3|4}] This option enables performance advisory messages. The optional level 1, 2, 3, or 4 controls how verbosely the performance advisory messages are emitted. The higher the level, the more messages are generated. Level 1 emits only the most important messages, while level 4 emits all the messages.
HP-UX B.11.61 linker (patch PHSS_36342 or PHSS_36349), compiling with the +Oautoparoption causes them to be automatically included. Older linkers require those libraries to be specified explicitly or by compiling with +Oopenmp. At present, +Oautoparis only supported when compiling C or Fortran files, and not C++ files.
all Emits debug information for all macros. This option can cause a significant increase in object file size. none Does not emit any macro debug information. One of the -g options (-g, -g0, or -g1) must be used to enable the +macro_debugoption. +nomacro_debug suppresses emission of macro debug information into the object file. +pathtrace (New) +pathtrace[=kind] The +pathtraceoption provides a mechanism to record program execution control flow into global and/or local path tables.
Descriptions: • +check=globals The +check=globals option enables runtime checks to detect corruption of global variables by introducing and checking "guards" between them, at the time of program exit. Setting environment variable RTC_ROUTINE_LEVEL_CHECK will also enable the check whenever a function compiled with this option returns.
As with any -B option, -Bhidden_def can be overridden by subsequent -B options on the command line or any binding pragmas in the source. -dM (New) -dM The -dM option requires that-P or -E also be specified. When -dM is present, instead of normal preprocessor output the compiler lists the #define directives it encounters as it preprocesse the file, thus providing a list of all macros that are in effect at the start of the compilation.
Change in treatment of cv-qualified assignment operators A user-defined assignment operator that is a const or volatile member function, is not considered a copy assignment operator, and the compiler will not suppress the declaration of an implicit copy assignment operator. As a result, the implicitly generated version might be chosen during overload resolution, if it is a better match.
• System-wide option configuration (New) • [NO]PTRS_TO_GLOBALS Pragma (New) • -AA -D_HP_NONSTD_FAST_IOSTREAM performance Macro (New) • New function attributes • Improved Diagnostics • C++ Standard Library HP Code Advisor This release introduces a new tool "HP Code Advisor", that can be used for detecting various programmer errors in C/C++ source code. Use this tool to identify potential coding errors, porting issues and security errors.
+wendian option (New) This option allows the user to identify areas in their source that might have porting issues when going between little-endian and big-endian. +wlint option (Enhanced) New diagnostic features have been added for this option. New checks have been added for memory leaks, out-of-scope memory access, null pointer dereference, and out-of-bounds access.
Enabling this macro might result in noticeable performance improvement if the application uses iostreams often. NOTE: Do not enable the macro in any of the following cases: • If the application assumes a C++ stream to be in sync with a C stream. • If the application depends on stream flushing behavior with endl. • If the user uses "std::cout.unsetf(ios::unitbuf)" to unit buffer the output stream.
4 Installation information Read this entire document and any other release notes or readme files you may have before you begin an installation. To install your software, run the SD-UX swinstall command. This invokes a user interface that will lead you through the installation. For more information about installation procedures and related issues, refer Managing HP-UX Software with SD-UX and other README, installation, and upgrade documentation provided or described in your HP-UX 11.
5 Compatibility information Maintaining binary compatibility is a key release requirement for new versions of HP aC++. The compiler has maintained the same object model and calling convention and remains compatible with the HP-UX runtime in the code that it generates as well as its intrinsic runtime library (libCsup) across the various releases of HP aC++ and its run-time patch stream.
with the following command in the body of the message: subscribe list-name The information about subscribing to the cxx-dev list server can be obtained from: http://www.hp.com/go/aCC Available list-names are as follows: cxx-dev (HP C++ Development Discussion List) cxx-dev-announce (HP C++ Development Announcements) cxx-dev-digest (HP C++ Development Discussion List Digest) For additional help or information about the list server, send a message to majordomo@cxx.cup.hp.
6 Known problems and workarounds This section describes known problems and workarounds. Customers on support can use the product number to assist them in finding SSB and SRB reports for HP aC++ or HPC. The product number you can search for is B3910BA. To verify the product number and version for your HP aC++ or HP C compiler, execute the following HP-UX commands: what /opt/aCC/bin/aCC what /opt/aCC/lbin/ecom Obsolete LANG-STARTUP files As of HP aC++ version A.06.
.section .sdata = "asw", "progbits" .align 8 gggggggg:: data4 0x000003e7 Object files generated at +O4 or -ipo Object files generated by the compiler at optimization level 4, called intermediate object files, are intended to be temporary files. These object files contain an intermediate representation of the user code in a format that is designed for advanced optimizations. The size of these intermediate object files may be 3 to 10 times as large as normal object files.
... #include #undef max #undef min ... Known limitations The following is a list of known limitations for this release. Some of these limitations will be removed in future releases of HP aC++. Please be aware that some of these limitations are platform-specific. • HP aC++ does not support large files (files greater than 2 GB) with or • Symbolic debugging information is not always emitted for objects which are not directly referenced.
For example, if libA.so is now a symbolic link to libA.so.1, then calls to dynamically load this library should specify the latest version available when the application is compiled, such as: shl_load("libA.so.1", BIND_DEFERRED, 0); This will insure that, when the application is migrated to a system that has a later version of libA available, the actual version desired is the one that is dynamically loaded.
7 Related documentation Documentation for HP aC++ / HP C is described in the following sections. Online documentation The following online documentation is included with the HP aC++/HP C products: • HP aC++ Programmer’s Guide Access this guide in any of the following ways: ◦ Use the +help command-line option: /opt/aCC/bin/aCC +help ◦ From your web browser, enter the appropriate URL: file:/opt/aCC/html/C/guide/index.
• Rogue Wave Software Standard C++ Library 1.2.1 Class Reference This reference provides an alphabetical listing of all of the classes, algorithms, and function objects in the prior Rogue Wave implementation of the Standard C++ Library. It is provided as HTML formatted files. You can view these files with an HTML browser by opening the file /opt/aCC/html/libstd/ref.htm. • Rogue Wave Software Tools.h++ 7.0.6 Class Reference This reference describes all of the classes and functions in the Tools.
Refer the home page for the latest information regarding: • Frequently Asked Questions • Release Version and Patch Table • Purchase and Support Information • Documentation Links • Compatibility between Releases. HP C world wide web homepage Access the HP C World Wide Web Homepage at the following URLs: http://www.hp.