<< next Title Contents Index Home Help

C C++ Dialect Supported


The PGCC C++ compiler accepts the C++ language as defined by The Annotated C++ Reference Manual (ARM) by Ellis and Stroustrup, Addison-Wesley, 1990, including templates, exceptions, and support for the anachronisms described in section 18 of the ARM. This is the same language defined by the language reference for ATT's cfront version 3.0.1, with the addition of exceptions. PGCC C++ optionally accepts a number of features erroneously accepted by cfront version 2.1. Using the -b option, PGCC C++ accepts these features, which may never have been legal C++ but have found their way into some user's code.

Command-line options provide full support of many C++ variants, including strict standard conformance. PGCC C++ provides command line options that enable the user to specify whether anachronisms and/or cfront 2.1 compatibility features should be accepted. Refer to Section C.4 for details on features that are not part of the ARM but are part of the ANSI C++ working draft X3J16/WG21.

C.1 Anachronisms Accepted

The following anachronisms are accepted when anachronisms are enabled (when the +p option is not used):

      int f(int); 
int f(x) char x; return x;
      struct A {
A(int);
A operator=(A&);
A operator+(const A&);
}; main () {
A b(1);
b = A(1) + A(2); // Allowed as anachronism
}

C.2 New Language Features Accepted

The following features not in the ARM but in the X3J16/WG21 Working paper are accepted:

C.3 The following language features are not accepted

The following features not in the ARM but in the X3J16/WG21 Working Paper are accepted:

C.4 Extensions Accepted in Normal C++ Mode

The following extensions are accepted in all modes (except when strict ANSI violations are diagnosed as errors, see the -A option): *

      class A {
friend B; // Should be "friend class B"
};*

      class A {
const int size = 10;
int a[size];
};*

      struct A{
int A::f(); // Should be int f();
}
      struct A { } ;
struct B : public A {
B& operator=(A&);
};

C.5 cfront 2.1 Compatibility Mode

The following extensions are accepted in cfront 2.1 compatibility mode in addition to the extensions listed in the 2.1/3.0 section following (i.e., these are things that were corrected in the 3.0 release of cfront):

               int a1;
int e1;
void f1();
class A {
int a1;
void f1();
friend void f()
{
int i1 = a1; // cfront uses global a1
f1(); // cfront uses global f1
}
};
int a1;
int b1;
struct A {
static int a1;
class B {
static int b1;
friend void f()
{
int i1 = a1; // cfront uses A::a1
int j1 = b1; // cfront uses global b1
}
};
};
class A {
A() const; // No error in cfront 2.1 mode
};

C.6 cfront 2.1/3.0 Compatibility Mode

The following extensions are accepted in both cfront 2.1 and cfront 3.0 compatibility mode (i.e., these are features or problems that exist in both cfront 2.1 and 3.0):

      		struct A {
friend B;
};
 			int *p;
const int *&r = p; // No temporary used


<< next Title Contents Index Home Help