HP aC++/HP ANSI C A.06.28 Release (769149-001, March 2014)

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. The function is declared not to throw any exceptions if the value of the constant expression
is true. The noexcept’ operator without a constant expression is equivalent to noexcept(true).
For example:
template <class T>
void foo() noexcept(noexcept(T())) {}
void bar() noexcept(true) {}
void baz() noexcept { throw 42; }
int main()
{
foo<int>(); // fine
bar(); // fine
baz(); // compiles, but at runtime this calls std::terminate()
}
Range-based for loops
This release of the compiler supports range-based for loop’ as described by N2778 under the
C++11 compilation mode.
For example:
int main()
{
int my_array[5] = {1, 2, 3, 4, 5};
int sum = 0;
for (auto &x : my_array) {
sum += x;
}
}
Opaque enumeration definitions
This release of the compiler supports the ‘Opaque enumeration as described by N2764 under
the C++11 compilation mode. It allows forward declaration of enumerations by declaring an
enumeration without providing its enumerators.
For example:
class S
{
public:
enum E : int;
E e;
};
enum S::E : int
10 What’s new in this version?