![]() | Warning: Although the following anachronisms are accepted, it is not recommended that they be used. Unpredictable results can occur. |
The following anachronisms to the Standard are accepted when anachronisms are enabled (via the -anach option):
overload is allowed in function declarations. It is accepted and ignored.
Definitions are not required for static data members that can be initialized using 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 may 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 may be omitted in a base class initializer if there is only one immediate base class.
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 may participate in function overloading as though it were prototyped. Default argument promotion is not applied to parameter types of such functions when the check for compatibility is performed, so that the following declares the overloading of two functions named f():
int f(int); int f(x) char x; { return x; } |
![]() | Note: In C, this code is legal but has a different meaning: a tentative declaration of f() is followed by its definition. |
A reference to a non-const class can be bound to a class rvalue of the same type or a derived type thereof. Example:
struct A { A(int); A operator=(A&); A operator+(const A&); }; main () { A b(1); b = A(1) + A(2); // Allowed as anachronism } |