Warning C26495 on structures?
13:25 13 Apr 2019

I've been using C#/.NET for the past decade or two, but am updating an old C++/MFC application for a client. I know a lot has changed since I last worked with C++, but this one kind of threw me.

I have the following structure:

typedef struct _FILTERINFO {
    int nCustomerID;
    CString sCustomerName;
} FILTERINFO, *LPFILTERINFO;

And Visual Studio 2019 gives me a warning:

Warning C26495 Variable '_FILTERINFO::nCustomerID' is uninitialized. Always initialize a member variable (type.6).

So, what is the problem here and how would I initialize the variable? As you can see, I don't have a constructor. I don't need them for structures now do I?

NOTE: Looking into this further, I see my app defines other struct that for some reason do not get this same warning. It seems specific to about two or three declarations.

c++ visual-studio compiler-warnings