Extensions accepted in normal C++ mode
By default, the following extensions are accepted (except when
strict ISO violations are diagnosed as errors via the -Xe option).
Using them is discouraged unless they occur in existing code which is difficult
to change.
-
A friend declaration for a class may omit the class keyword:
class B;
class A {
friend B; // Should be "friend class B"
};
-
Constants of scalar type may be defined within classes (this is an old form;
the modern form uses an initialized static data member):
class A {
const int size = 10;
int a[size];
};
-
In the declaration of a class member, a qualified name may be used:
struct A {
int A::f(); // Should be int f();
}
-
The preprocessing symbol c_plusplus is defined in addition to
the standard __cplusplus.
-
A pointer to a constant type can be deleted.
-
An assignment operator declared in a derived class with a parameter
type
matching one of its base classes is treated as a ``default''
assignment
operator --- that is, such a declaration blocks the implicit
generation
of a copy assignment operator. (This is cfront behavior that is known
to
be relied upon in at least one widely used library.) Here's an
example:
struct A { };
struct B : public A {
B& operator=(A&);
};
By default, as well as in cfront-compatibility mode, there will be no
implicit declaration of B::operator=(const B&), whereas in
strict-ISO mode B::operator=(A&) is
not
a copy
assignment
operator and B::operator=(const B&)
is
implicitly
declared.
-
Implicit type conversion between a pointer to an extern "C" function
and a pointer to an extern "C++" function is permitted:
extern "C" voidf();
void (*pf) () = &f ; //allowed
-
The long long and unsigned long long built-in types are supported,
representing 64-bit signed and unsigned integers.
-
The NCEG Floating Point Specification relational operators are supported.
These extend the set of basic comparisons to support the notion of "unordered"
from the IEEE 754 floating point standard.
In addition, the compiler accepts most of the preprocessing and
assembly-level extensions of the SCO OpenServer C compiler.
These include #assert, #ident, #pragma ident,
#pragma weak, #pragma pack, old-style asms and enhanced
asms.
Next topic:
Anachronisms accepted
Previous topic:
Normal C++ mode
© 2005 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 -- 02 June 2005