W8006 Initializing 'identifier' with 'identifier' (C++)

From RAD Studio
Jump to: navigation, search

Go Up to Compiler Errors And Warnings (C++) Index

(Command-line option to suppress warning: -w-bei)

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

For example, the following initialization will result in this warning, because 2 is of type int, not type enum count:

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

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.