C++Builder 2009 introduces forward declaration of enums. You can declare an enumeration without providing a list of enumerators. Such declarations would not be definitions and can be provided only for enumerations with fixed underlying types. An enumeration can then be re-declared, possibly providing the missing list of enumerators, but the re-declaration must match the previous declaration. This feature is one of the C++0x features added to C++Builder 2009.
enum E : short; // OK: unscoped, underlying type is short enum F: // illegal: enum-base is required enum class G : short // OK: scoped, underlying type is short enum class H; // OK: scoped, underlying type is int enum E : short; // OK: redeclaration of E enum class G : short; // OK: redeclaration of G enum class H; // OK: redeclaration of H enum class H : int; // OK: redeclaration of H enum class E : short; // illegal: previously declared as unscoped enum G : short; // illegal: previously declared as scoped enum E; // illegal: enum-base is required enum E : int // illegal: different underlying type enum class G; // illegal: different underlying type enum class H : short; // illegal: different underlying type enum class H {/* */}] // OK: this redeclaration is a definition
Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
|
What do you think about this topic? Send feedback!
|