Forum - MCS Electronics

 

FAQFAQ SearchSearch RegisterRegister Log inLog in

How to auto remark unused variables?

 
Post new topic   Reply to topic    www.mcselec.com Forum Index -> BASCOM-AVR
View previous topic :: View next topic  
Author Message
TSEYFARTH

Bascom Member



Joined: 01 Jul 2006
Posts: 1054

usa.gif
PostPosted: Wed Oct 11, 2017 5:13 am    Post subject: How to auto remark unused variables? Reply with quote

Hello all.

Using IDE version 2.0.8.0.004, the code explorer shows vars not used, but there does not appear to be a way to auto remark them all. Am I missing something? Is there a way? If so how?

Thank you!
Tim

(BASCOM-AVR version : 2.0.8 , Latest : 2.0.7.8 )
Back to top
View user's profile
AdrianJ

Bascom Expert



Joined: 16 Jan 2006
Posts: 2482
Location: Queensland

australia.gif
PostPosted: Wed Oct 11, 2017 10:36 pm    Post subject: Reply with quote

Why go to the work of creating a variable if you are not going to use it ?

You can certainly have a collection of test variables, to see what is happening while debugging. If you use conditional compile, you can 'switch' them on only when the test code runs.
Code:


Const DebugMe = 1 'set to 0 for no debugging
....
#if DebugMe = 1
dim MyTestVar as  single
... 'any others you want
#endif

....'then in your code:

#if DebugMe = 1
MyTestVar = 'whatever you want to get from working variables
print MyTestVar
#endif
 


So the debugging variables are only defined and used when in debugging mode.
This way you can set up quite complex debugging stuff, and switch it in and out as needed, eg by setting the DebugMe constant to a different value for each run

_________________
Adrian Jansen
Computer language is a framework for creativity
Back to top
View user's profile Visit poster's website
TSEYFARTH

Bascom Member



Joined: 01 Jul 2006
Posts: 1054

usa.gif
PostPosted: Wed Oct 11, 2017 11:22 pm    Post subject: Reply with quote

Hi Adrian,

Thank you for your reply. That is not exactly what I am looking for. I used code from a different project that was very near what the new project has to do. However now, in this smaller project, there are tons of vars dimensioned which are not used. The IDE *knows* which are not used (dead they call them) but I was hoping there was a way to automatically remark them out. ie an IDE function.

Thanks again,
Tim
Back to top
View user's profile
AdrianJ

Bascom Expert



Joined: 16 Jan 2006
Posts: 2482
Location: Queensland

australia.gif
PostPosted: Thu Oct 12, 2017 5:40 am    Post subject: Reply with quote

No way to automate it that I know of, but you can at least double-click on the greyed out entry in the code explorer and that jumps you to the DIM statement for that variable.
_________________
Adrian Jansen
Computer language is a framework for creativity
Back to top
View user's profile Visit poster's website
TSEYFARTH

Bascom Member



Joined: 01 Jul 2006
Posts: 1054

usa.gif
PostPosted: Thu Oct 12, 2017 5:58 am    Post subject: Reply with quote

Hi Adrian,
I did not know that! It's sure easier than having to find it first!

Thank you!
Tim
Back to top
View user's profile
kimmi

Moderator



Joined: 24 Feb 2006
Posts: 1922
Location: Denmark

denmark.gif
PostPosted: Thu Oct 12, 2017 1:35 pm    Post subject: Reply with quote

The fastest was to find them is CTRL+W scrool down to bottom
here you see unused vars under "Warnings:"

_________________
/ Kim
Back to top
View user's profile Visit poster's website MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    www.mcselec.com Forum Index -> BASCOM-AVR All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
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 vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum