ROBOTC.net forums
http://robotc.net/forums/

variables not visible in debug with JoystickDriver.c
http://robotc.net/forums/viewtopic.php?f=52&t=3937
Page 1 of 1

Author:  gnormhurst [ Thu Dec 29, 2011 9:21 pm ]
Post subject:  variables not visible in debug with JoystickDriver.c

When I have global variables and the #include "JoystickDriver.c" many of the variables are not visible in the Program Debug window. When I remove the #include "JoystickDriver.c" line all variables become visible in the Program Debug window.

See the two screen shots. (The white X's are warnings because those variables are never read.)

Without #include:

Image


With #include:

Image

Is this a bug or am I doing something wrong?

-Norm Hurst

Author:  l0jec [ Fri Dec 30, 2011 10:43 am ]
Post subject:  Re: variables not visible in debug with JoystickDriver.c

I should play around with the IDE before replying, but just to take a guess... the debug window is titled "Global Variables"; maybe you're looking at it the wrong way?
Could it be that it should only be displaying global variables, but just happens to show local variables when you have no other tasks or functions besides main? In a way I can see how those local variables would have scope equivalent to global as they are accessible by all the compiled code when there are no other tasks/functions defined?

To test this (I do not have access to ROBOTC at the moment), what happens if you define another task or function in the same file without using any includes?

Author:  gnormhurst [ Fri Dec 30, 2011 2:42 pm ]
Post subject:  Re: variables not visible in debug with JoystickDriver.c

Quote:
I should play around with the IDE before replying, but just to take a guess... the debug window is titled "Global Variables"; maybe you're looking at it the wrong way?
Could it be that it should only be displaying global variables, but just happens to show local variables when you have no other tasks or functions besides main?

If that were the case, then something is still wrong, because the fourth global variable is not being shown.

Quote:
In a way I can see how those local variables would have scope equivalent to global as they are accessible by all the compiled code when there are no other tasks/functions defined?

To test this (I do not have access to ROBOTC at the moment), what happens if you define another task or function in the same file without using any includes?

In short, no change. I added

Code:
task sub1()
{
  short sub1_1;
}


and it showed the same behavior as originally described. Then I added

Code:
int clip( int in, int hi, int lo)
{
  if ( in > hi ) in = hi;
  if ( in < lo ) in = lo;
  return in;
}


Again, no difference in behavior.

Page 1 of 1 All times are UTC - 5 hours [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/