Advertisement

what is unreferenced local variable

Started by February 24, 2003 08:01 AM
2 comments, last by GRR 21 years, 8 months ago
warning C4101: hbrush'' : unreferenced local variable warning C4101: ''ps'' : unreferenced local variable the program still runs but gets this warning???
I think that is when a variable is declared but never used.
Advertisement
void some_fubar(int a, int b)
{
int NOT_USED;


return(a*b);
}

In the above example NOT_USED would be an unreferenced local variable.

Basically the function has a parameter or declares a local variable that is not used in it.
That meen that you have allocated space on the stack for a variable that never was used in the function. It doesn''t really matter, if you remove the variables the program will still run as fine it did with them. Even better as you will not pollute the stack as much. Example:

  void foo(){   int bar; // warning C4101: bar'' : unreferenced local variable}  



Update GameDev.net system time campaign - success at last
Arguing on the internet is like running in the Special Olympics: Even if you win, you're still retarded.[How To Ask Questions|STL Programmer's Guide|Bjarne FAQ|C++ FAQ Lite|C++ Reference|MSDN]

This topic is closed to new replies.

Advertisement