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
Post a Comment