mardi 30 novembre 2021

Enumerator value evaluates to 2147483648, which cannot be narrowed to type 'int'

I created an enum like this:

enum class CATEGORIES{
       C01 = 0x00000001,
       C02 = 0x00000002,
       C03  = 0x00000004,
       ...
       C26 = 0x02000000,
       C27 = 0x04000000,
       C28 = 0x08000000,
       C29 = 0x10000000,
       C30 = 0x20000000,
       C31 = 0x40000000,
       C32 = 0x80000000, //Error at this line
    }

Enumerator value evaluates to 2147483648, which cannot be narrowed to type 'int'

How should I resolve it? I just wanted a convenient way of representing the categories, and enum class seemed to make sense for namespacing..

Aucun commentaire:

Enregistrer un commentaire