View unanswered posts | View active topics It is currently Sat Aug 30, 2014 1:08 am






Reply to topic  [ 3 posts ] 
variables not visible in debug with JoystickDriver.c 
Author Message
Rookie

Joined: Thu Dec 29, 2011 8:34 pm
Posts: 14
Post 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


Thu Dec 29, 2011 9:21 pm
Profile
Expert

Joined: Mon Oct 27, 2008 9:59 pm
Posts: 137
Post 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?


Fri Dec 30, 2011 10:43 am
Profile
Rookie

Joined: Thu Dec 29, 2011 8:34 pm
Posts: 14
Post 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.


Fri Dec 30, 2011 2:42 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 3 posts ] 

Who is online

Users browsing this forum: mightor and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  



Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.