mercredi 4 septembre 2019

uninit_member: Non-static class member field m_cJobState.bstatus is not initialized in this constructor nor in any functions that it calls

I am getting the below warning at SubManager constructor:

Uninitialized scalar field (UNINIT_CTOR)

uninit_member: Non-static class member field m_cJobState.bEULA is not initialized in this constructor nor in any functions that it calls.

uninit_member: Non-static class member field m_cJobState.bstatus is not initialized in this constructor nor in any functions that it calls.

uninit_member: Non-static class member field m_cJobState.eActivationState is not initialized in this constructor nor in any functions that it calls.

Below is the code snippet:

SubManager.h file

struct MgrStatus
{
    bool bEULA;                 
    bool bstatus; 
    WorkState eActivationState;
};

class SubManager
{
private:
    MgrStatus m_cJobState;   
};

SubManager.cpp file

SubManager::SubManager()
{
}

To resolve the warning,

Do we need to initialize structure variables in the above constructor? If we need to initialize, how to initialize the enum variable (WorkState eActivationState;)?

Aucun commentaire:

Enregistrer un commentaire