What is the underlying type of a c++ enum?

后端 未结 3 1425
感动是毒
感动是毒 2020-11-30 03:18

This may have been answered elsewhere but I could not find a suitable response.

I have this code:

enum enumWizardPage
{
    WP_NONE = 0x00,  
    WP_         


        
3条回答
  •  一生所求
    2020-11-30 03:27

    IIRC its represented as int in memory. But gcc has switch -fshort-enum to make it a shortest integer type that fits all the values, if you need to save space. Other compilers will have something similar.

提交回复
热议问题