HP aC++/HP ANSI C A.06.
© Copyright 2012, 2014 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 HP secure development lifecycle......................................................................7 1 HP aC++/HP ANSI C Release Notes............................................................8 2 What’s new in this version?.........................................................................9 Improved support for C++11 core language features.....................................................................9 Uniform initialization ..........................................................
New features in version A.06.26..............................................................................................20 Improved GNU compatibility and new GNU features.............................................................21 Support for GNU statement expression.............................................................................21 Support for _Pragma ("once").........................................................................................21 C++0x language extensions............
#pragma diag_push (New).................................................................................................38 #pragma diag_pop (New)..................................................................................................38 +Oinlinebudget is deprecated (Change)...............................................................................38 In next release, default C compilation mode will change from C89 to C99................................
Caliper compatibility..............................................................................................................51 WDB compatibility.................................................................................................................51 Difference in class size when compiling in 32-bit and 64-bit mode................................................51 Migrating from HP C++ (cfront) to HP aC++..............................................................................
HP secure development lifecycle Starting with HP-UX 11i v3 March 2013 update release, HP secure development lifecycle provides the ability to authenticate HP-UX software. Software delivered through this release has been digitally signed using HP's private key. You can now verify the authenticity of the software before installing the products, delivered through this release. To verify the software signatures in signed depot, the following products must be installed on your system: • B.11.31.
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.28 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.
struct BasicStruct { int x; double y; }; class AltStruct { public: AltStruct(int x, double y) : x_{x}, y_{y} {} int x_; double y_; }; int main(int argc, char** argv) { BasicStruct var1{5, 3.2}; AltStruct var2{2, 4.3}; // Constructor will be called int arr[] { 1,2,3,4,5 }; return 0; } "noexcept" specifier and operator This release of the compiler supports ‘noexcept specifier and operator’ under the C++11 compilation mode.
{ RED, GREEN, BLUE }; constexpr This release of the compiler supports ‘constexpr’ under the C++11 compilation mode. The "constexpr" feature allows functions and constructors that return constant values for constant arguments, and variables whose initializers must be reduced to constants at the compile time. Check N2235 and the additions in N3078, N3268, and N3277.
For example: struct S { S(int); S(): S(0) {} // Default constructor for S delegates to constructor }; // S::S(int). Raw string literals This release of the compiler supports ‘Raw string literals’ as described by N2442 and N3077 under the C++11 compilation mode. It allows the specification of string literals containing characters that otherwise have special meaning. These literals can span multiple lines and escape sequences, and trigraphs are not translated.
Networking::TCPSocket *t; // because of the Networking::V1::TCPSocket *t2; Networking::V2::TCPSocket *t3; return 0; // Networking::V2::TCPSocket, inline namespace // Networking::V1::TCPSocket // Networking::V2::TCPSocket } Implicit move constructors and assignment operators This release of compiler supports ‘Implicit move constructor and assignment operator’ as described by N3053 under the C++11 compilation mode.
Option to perform instruction scheduling for Poulson based Itanium® architecture +DSpoulson: This option performs instruction scheduling for Poulson implementation of the Itanium® architecture. Instruction scheduling is different on different implementations of Itanium® based architectures. Performance on a particular model or processor of the HP-UX system can be improved by requesting that the compiler uses the instruction scheduling tuned to that particular model or processor.
Syntax: export CXX_MAP_FILE=file path Example: export CXX_MAP_FILE=/home/src/my_option.map The above example specifies that HP aC++ should use mapping file from file path specified using CXX_MAP_FILE. Defining the Mapping Rules: The following syntax is for defining the rules in the mapping file: LHS => RHS NOTE: Ensure to use a space before and after "=>".
3 Product changes in earlier versions New features in 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.
{ 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(){...} int main(int argc, char** argv) { return f(); } Standard attributes In C++11 mode, the attributes "align", "carries_dependency", "final", and "noreturn" are now supported.
Built-in macro __cpluspluss The built-in macro __cplusplus now has a value of 201103L when the compiler is run in the C++11 mode (using the +std=c++11) option. Earlier, the value was 199711L irrespective of the mode of execution. Improved support for GNU extensions This release of aC++ supports a host of GNU compiler extensions. For more details about these features, see the GNU documentation available at http://gcc.gnu.org/onlinedocs/gcc/.
}; T& in template that can be deduced to match "this" template void gg(T &r) { r = 0; } struct A { void f() { gg(this); // T deduced as "A *const", assignment in gg gets error } }; 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__.
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.
Example 2 Globally unique names for unnamed types and static routines template void f(T) {} template void f(T, T1) {} struct {} s; enum {} e; static void f2(); void f1() { f2(); // ZN22_INTERNAL_3_x_c__Z2f1v2f2Ev f(s); // _Z1fIN22_INTERNAL_3_x_c__Z2f1v4__C1EEvT f(e); // IA-64: Z1fIN22_INTERNAL_3_x_c__Z2f1v4__E2EEvT f(s, s); //_Z1fIN22_INTERNAL_3_x_c__Z2f1v4__C1ES1_EvT_T0_ f(e, e); // Z1fIN22_INTERNAL_3_x_c__Z2f1v4__E2ES1_EvT_T0 f(s, e); //_Z1fIN22_INTERNAL_3_x_c__Z2f1v4__C1ENS0_4__E2EEvT_T0_ } static void f
Deprecated and obsoleted 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++. The default on Integrity servers is -AA, so the sources should be ported to -AA mode. For more information, see http://www.hp.com/go/aCC and click C++ runtime environments (-AA and -AP) on HP-UX under HP aC++ Resources.
• +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. • +M[d] / +m[d] These are options used in PA-RISC aC++, and are replaced by the longer +Make[d] and +make[d] forms to prevent confusion with the unrelated previous +m in HP C. • +O[no]all This option was deprecated earlier. • +O[no]conservative This option was deprecated earlier.
◦ 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) • Non-template static data members initialized outside the class no longer treated as constants in strict mode (Changed) • Enhancements to allow code to run well on current platforms and future multi-core processors (New) • New diagnostic me
To retain the previous behavior, use the -Wc,-ansi_for_scope,off command-line option.
S s1; // Will trigger an error when the static_assert // declaration is instantiated. Extended friend types Support is now included for extended friend declaration syntax which allows for non-class names and non-elaborated class names to be declared as friend.
Special member functions that can be implicitly defined can instead be explicitly declared, but with a default definition.
Example for +DD32: bool b = 4000000000 > -1; // b = true in C++0x mode. // b = false in default C++ mode with long long enabled. // (In that case, a warning is issued on the conversion of -1 // to an unsigned type.) For +DD64, both modes are the same for that literal value. Variadic macros With this release, aC++ now accepts C99-style variadic macros in C++0x mode.
C++ support currently has a limitation of not being able to use the three new Decimal FP types in a throw expression or a typeid operator. For more information on using Decimal FP, see the release notes section "Decimal floating-point arithmetic supported" under "New Features in the A.06.20 Release." #pragma STDC FLOAT_CONST_DECIMAL64 (New) #pragma STDC FLOAT_CONST_DECIMAL64 [ON | OFF | DEFAULT] With this pragma set to OFF, unsuffixed floating-point constants are treated as having type double.
Performance enhancements for +O1 (Changed) Various performance improvements have been made for +O1. One specific improvement is that +Odataprefetch=direct is now supported at +O1, and is the default at +O1. This may help improve performance for code using loops.
Warning #2069 is replaced with warning #2767 when appropriate. Diagnostic #2069 is now suppressed in cases where it appeared in addition to diagnostic #2513. Diagnostic #3056 is now suppressed in cases where it appeared in addition to diagnostic #2120. Diagnostic #2028 is now suppressed in cases where it appeared in addition to diagnostic #2060.
• 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. This support follows the current draft revision of the IEEE 754 floating-point standard and ISO/IEC Technical Report 24732, Extensions for the programming language C to support decimal floating-point arithmetic.
• Decimal FP versions of macros in , , and . • Five rounding modes for decimal FP: to nearest with ties to even, to nearest with ties away from zero, upward, downward, and toward zero. • Compiler option +decfp, which enables full decimal FP functionality according to the ISO/IEC C draft Technical Report: http://www.open-std.org/jtc1/sc22/wg14/www/docs/ n1312.
* **********************************************************************/ const char * ifilename = "biller.in"; // input file const char * ofilename = "biller.out"; // output file const enum { ascii, bid, dpd } encoding = ascii; // input encoding const _Decimal64 rate = 149.95DD; // hourly billing rate #define __STDC_WANT_DEC_FP__ #include #include #include #include #include #include
exit(EXIT_FAILURE); } if (s == EOF) break; } else if (encoding == bid) { r = (int) fread(&be, sizeof(_Binaryencoding64), 1, inp); if (r != 1) break; m = _decodebinary64(be); // decode bid } else /* encoding == dpd */ { r = (int) fread(&de, sizeof(_Decimalencoding64), 1, inp); if (r != 1) break; m = _decodedecimal64(de); // decode dpd } // compute hours billed fe_dec_setround(FE_DEC_UPWARD); h = m / 60; h = quantized64(h, onert); // round to tenths // compute billing amount fe_dec_setround(FE_DEC_TONEARESTFR
• On the HP-UX implementation, BID data could be read directly into the decimal FP variable m, without the need of decoding. However, that code would not be portable to systems that use DPD encoding for their decimal FP types. • Restoring the default rounding has no effect in this program, except perhaps if the ASCII input had more than 16 decimal digits, but doing so is a good programming practice.
+inline_level num (Enhanced) The format for num is now N[.n], where num is either an integral value from 0 to 9 or a value with a single decimal place from 0.0 to 9.0, as follows: • 0 No inlining is done (same effect as the +d option). • 1 Only functions marked with the inline keyword or implied by the language to be inlined are considered for inlining. • 1.0 < num < 2.0 Increasingly make inliner more aggressive below 2.0. • 2 More inlining than level 1.
error #2066: enumeration value is out of "int" range error #4041: enumeration value is out of "char" range • Restriction on constant expressions: error #2057: this operator is not allowed in a constant expression error #2028: expression must have a constant value Was this: warning #4045-D: non-constant initialization performed at runtime • Non-static inline can't reference static: error #3031-D: an entity with internal linkage cannot be referenced within an inline function with external linkage • Use
• +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 (New) • Debugging code compiled with opt levels above +O1 now supported (New) • __attribute__ ((visibility("default"|"protected"|"hidden"))) (New) • __attribute__ ((warn_unused_result)) (New) • Cha
are generated. Level 1 emits only the most important messages, while level 4 emits all the messages. If the optional level is not specified, it defaults to 2. +Wv option (New) +Wv[d1,d2,...,dn] The new +Wvoption displays the description for diagnostic message numbers d1,d2,...,dn. Specifying this option causes HP Code Advisor to emit the descriptive text for the specified diagnostics to stderr. This option must not be used with any other compiler options.
+O[no]loop_block option (New) +O[no]loop_block Loop blocking is a combination of strip mining and interchange that improves data cache locality. It is provided primarily to deal with nested loops that manipulate arrays that are too large to fit into the data cache. Under certain circumstances, loop blocking allows reuse of these arrays by transforming the loops that manipulate them so that they manipulate strips of the arrays that fit into the cache.
The +pathtraceoption provides a mechanism to record program execution control flow into global and/or local path tables. The saved information can be used by the HP WDB debugger to assist with crash path recovery from the core files, or to assist when debugging the program by showing the executed branches. Usage: The defined values for kind are: local Generates a local path table and records basic block-execution information in it at runtime.
The +check=globals option is implied by +check=all. • +check=truncate[:explicit|:implicit] The +check=truncate option enables runtime checks to detect data loss in assignment when integral values are truncated. Data loss occurs if the truncated bits are not all the same as the left most non-truncated bit for signed type, or not all zero for unsigned type. Programs may contain intentional truncation at runtime, such as when obtaining a hash value from a pointer or integer.
touch foo.c ; cc -E -dM foo.c #pragma OPT_LEVEL INITIAL (New) #pragma OPT_LEVEL INITIAL #pragma OPT_LEVEL has been enhanced to accept an additional keyword, INITIAL. When used with a numeric argument, the OPT_LEVEL pragma sets the optimization level to 0, 1, 2, 3, or 4. The INITIAL argument causes the optimization level in effect at the start of the compilation, whether by default or specified on the command line, to be restored.
int main() { S s1, s2; s1 = s2; const S s3; s3 = s2; return 0; // calls implicitly generated operator // previously used to call the user-defined one // still calls the user-defined operator }" New features in version A.06.12 Version A.06.
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. The HP Code Advisor is being made available on both HP-UX PA and Integrity servers. It leverages the advanced analysis capabilities of the C/C++ compilers for the Integrity servers. Use "/opt/cadvise/bin/cadvise" to invoke the tool.
+wsecurity= option (Enhanced) The +wsecurity option now optionally takes a argument to control how verbosely the security messages are emitted: +wsecurity=[1|2|3|4] The default level is 2. System-wide option configuration There is a new ability to configure compiler options on a system-wide basis. The compiler now reads the configuration file: /var/aCC/share/aCC.conf (aC++), or /var/ansic/share/cc.conf(ANSI C), if present.
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. New function attributes __attribute__ is a language feature that allows you to add attributes to functions. The capabilities are similar to those of #pragma.
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, see Managing HP-UX Software with SD-UX and other README, installation, and upgrade documentation provided or described in your HP-UX 11.x operating system package.
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.
8 Documentation feedback HP is committed to providing documentation that meets your needs. To help us improve the documentation, send any errors, suggestions, or comments to Documentation Feedback (docsfeedback@hp.com). Include the document title and part number, version number, or the URL when submitting your feedback.