RAD Studio |  |

Initializing enumeration with type (C++)

You're trying to initialize an enum variable to a different type. For example,

Copy Code

    enum count { zero, one, two } x = 2;

will result in this warning, because 2 is of type int, not type enum count. It is better programming practice to use an enum identifier instead of a literal integer when assigning to or initializing enum types.

This is an error, but is reduced to a warning to give existing programs a chance to work.

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!