I have read this link so have a basic understanding of what the warning refers to.
When I run code analysis on my MFC project I get a barrage of these warnings:
d:\my programs\2017\meetschedassist\meeting schedule assistant\synchexclusionsdlg.cpp(295): warning C6031: Return value ignored: 'ATL::CStringT<wchar_t,StrTraitMFC<wchar_t,ATL::ChTraitsCRT<wchar_t> > >::LoadStringW'.
d:\my programs\2017\meetschedassist\meeting schedule assistant\synchexclusionsdlg.cpp(297): warning C6031: Return value ignored: 'ATL::CStringT<wchar_t,StrTraitMFC<wchar_t,ATL::ChTraitsCRT<wchar_t> > >::LoadStringW'.
So, for example, it complains about this code snippet:
if (iImage == IMG_CHECKED)
strText.LoadString(IDS_STR_YES);
else
strText.LoadString(IDS_STR_NO);
I have read the help documentation for LoadString and ironically their example does this:
CAtlString s;
s.LoadString(IDS_APP_TITLE);
They don't test the return value either. :)
Now, I realise that I could try to fix my code and test the return values - which will take me a very long time! And I realise that I can just subconsciously ignore these warnings.
But is it possible to supress this specific warning (concerning C6031 CString::LoadString
) during analysis?
Update
I have tried adding this to my stdafx.h
(based on comments):
#pragma warning( disable : 6031)
It certainly works. But I was hoping to just supress 6031 errors for CString::LoadString
.