C++ Specific Language Conformance Options

Language conformance options specific to C++.

-h cfront

Default: off

Accept or reject constructs that were accepted by previous cfront-based compilers (such as Cray C++ 1.0) but which are not accepted in the C++ standard. The -h anachronisms option is implied when -h cfront is specified.

-h [no]parse_templates

Default: -h noparse_templates

Defines templates using previous versions of the Cray Standard Template Library (STL) (before Programming Environment 3.6) to compile successfully with the -h conform option. Use the -h noparse_templates option to compile existing code without having to use the Cray C++ STL. Also, the compiler defaults to this mode when the -h dep_name option is used. To have the compiler verify that the code uses the Cray C++ STL properly, use the -h parse_templates option.

-h [no]dep_name

Default: -h nodep_name

Enables or disables dependent name processing - the separate lookup of names in templates when the template is parsed and when it is instantiated. The -h dep_name option cannot be used with the -h noparse_templates option.

-h [no]exceptions

Default: -h exceptions

Enables support for exception handling. The -h noexceptions option issues an error whenever an exception construct, a try block, a throw expression, or a throw specification on a function declaration is encountered. If the CRAYOLDCPPLIB environment variable is set to a nonzero value, the default is -h noexceptions.

The -h exceptions option is enabled by -h conform.

-h [no]new_for_init

Default: -h new_for_init

Enables or disables the new scoping rules for a declaration in a for-init-statement. This means that the new standard-conforming rules are in effect; the entire for statement is wrapped in its own implicitly generated scope. The -h new_for_init option is implied by the -h conform option.

The result of the scoping rule:
  .
  .
  . 
  for (int i = 0; i < n; i++)  {
    .
    .
    .
  } // scope of i ends here for -h new_for_init
  .
  .
  .
}  // scope of i ends here for -h nonew_for_init
  

-h [no]const_string_literals

Default: -h noconst_string_literals

Controls whether string literals are const (as required by the standard) or not (as was true in earlier versions of the C++ language).

-h [no]anachronisms

Default: -h noanachronisms

Disables or enables anachronisms in Cray C++. This option is overridden by -h conform.

When anachronisms are enabled, the following anachronisms are accepted:
  • overload is allowed in function declarations. It is accepted and ignored.
  • Definitions are not required for static data members that can be initialized by using the default initialization. The anachronism does not apply to static data members of template classes; they must always be defined.
  • The number of elements in an array can be specified in an array delete operation. The value is ignored.
  • A single operator++() and operator--() function can be used to overload both prefix and postfix operations.
  • The base class name can be omitted in a base class initializer if there is only one immediate base class.
  • Assignment to the this pointer in constructors and destructors is allowed. This is only allowed if anachronisms are enabled and the assignment to this configuration parameter is enabled.
  • A bound function pointer (a pointer to a member function for a given object) can be cast to a pointer to a function.
  • A nested class name may be used as a non-nested class name if no other class of that name has been declared. The anachronism is not applied to template classes.
  • A reference to a non-const type may be initialized from a value of a different type. A temporary is created, it is initialized from the (converted) initial value, and the reference is set to the temporary.
  • A reference to a non-const class type may be initialized from an rvalue of the class type or a derived class thereof. No (additional) temporary is used.
  • A function with old-style parameter declarations is allowed and can participate in function overloading as though it were prototyped. Default argument promotion is not applied to parameter types of such functions when checking for compatibility, therefore, the following statements declare the overloading of two functions named f:
    int f(int); 
    int f(x) char x; { return x; }
    In C, this code is legal, but has a different meaning. A tentative declaration of f is followed by its definition.