| |||
| Home > C and C++ Implementation Details > C++ implementation details > Anachronisms | |||
The following anachronisms are accepted when you enable anachronisms
using the --anachronisms option:
overload is permitted 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, because these 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 permitted.
A bound function pointer, that is, a pointer to a member function for a given object, can be cast to a pointer to a function.
A nested class name can be used as a non-nested class name provided no other class of that name has been declared. The anachronism is not applied to template classes.
A reference to a non-const type
can 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 can be initialized from an rvalue of the class type or a class
derived from that class type. No, additional, temporary is used.
A function with old-style parameter declarations
is permitted and can participate in function overloading as if it
were prototyped. Default argument promotion is not applied to parameter
types of such functions when the check for compatibility is done,
so that the following declares 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.