c++ - Suppress C4189 in Visual Studio for each -


i'm working on visual studio 2013 , got simple loop

for each (const std::string &foo in stringlist) {      /*things happen here foo never used for*/ } 

in loop pop n elements list dont use foo here , got c4189 warning (w4) want suppress here.

i looked around , found several solutions like

for each (const std::string &foo in stringlist) {      (void)foo;     /*things happen here foo never used for*/ } 

or define solutions #define unused __pragma(warning(suppress:4189))

personally define solution, seems not work in loop because still got warning if use define.

so question:

is there way suppress warning without setting compiler flags? don't want use line inside loop suppress warning.


Comments

Popular posts from this blog

yii2 - Yii 2 Running a Cron in the basic template -

asp.net - 'System.Web.HttpContext' does not contain a definition for 'GetOwinContext' Mystery -

mercurial graft feature, can it copy? -