I wondered why my program does not recognize the variables that I declare, I have an error message " 'Vmin' unused variable" and Vmin was not declared in this scope " it is two contradictory messages, could you please explain this, thank you.
I wondered why my program does not recognize the variables that I declare, I have an error message " 'Vmin' unused variable" and Vmin was not declared in this scope " it is two contradictory messages, could you please explain this, thank you.
Is there a tool which can be used to optimize the code and also to find which all part of code is dead code( like some invalid if condtion which may never happen ),If you're using Visual Studio.Net, yes. It will tell you every time you compile.
Code:Vmin = double F (10, 300); Double Vmax = 0; double V; for (s = 1, s <= numItems; s + +) ( V = on_Num (s); if (V <Vmin) ( Vmin = V; ) if (V> Vmax) ( Vmax = V; ) ) cout << "MAX" on Num' "<<Vmax <<endl; cout << "MIN" on Num' "<<Vmin <<endl; <Error> </ error>
If variable <variable_name> or function <function_name> is not used, it can be removed. Any compiler warning is automatically treated like an error and the build will fail. If it is only used sometimes, you can use __attribute__((unused)). This attribute suppresses these warnings. For example:
Code:int __attribute__ ((unused)) functionname(int parm1, long parm2) { … } long __attribute__ ((unused)) variablename;
Bookmarks