View previous topic :: View next topic |
Author |
Message |
Duval JP
Joined: 22 Jun 2004 Posts: 1161 Location: France
|
Posted: Sun Feb 02, 2020 12:20 pm Post subject: grey code |
|
|
hello,
I was wondering about the unused code.
It appears in grey in the code, it's very useful for cleaning up.
but is it compiled and is it stored in the flash? unfortunately yes.
I'm working on a big program that exists in 4 versions,
not all of them use the same variables so it's handy to keep the grey lines.
Would it be possible to have a compile_Greycode =yes/no
in future releases ?
JP :wink:
(BASCOM-AVR version : 2.0.8.2 ) _________________ pleasure to learn, to teach, to create |
|
Back to top |
|
|
albertsm
Joined: 09 Apr 2004 Posts: 5913 Location: Holland
|
Posted: Mon Feb 03, 2020 11:17 am Post subject: |
|
|
it is intended for the reason to clean up.
typically you activate it when your project is done.
if you have different versions, you can best use conditional compilation like :
const myproject=1 'use different values for different projects
#if myproject=1
dim somevar as byte
#elseif myproject=2
dim othervar as byte
#else
dim whatever as byte
#endif
this is a common way to use source for multiple projects
but that said, a future update can remove dead code as it is working as expected now. _________________ Mark |
|
Back to top |
|
|
hgrueneis
Joined: 04 Apr 2009 Posts: 902 Location: A-4786 Brunnenthal
|
Posted: Mon Feb 03, 2020 10:44 pm Post subject: |
|
|
Greyed code for me is very useful. When I loose kind of track when I changed my mind for the tenth time on how to solve a problem
or make the program more efficient. In other words, a good thing!
Best regards
Hubert |
|
Back to top |
|
|
Duval JP
Joined: 22 Jun 2004 Posts: 1161 Location: France
|
Posted: Tue Feb 04, 2020 10:56 am Post subject: |
|
|
YES Hubert !
I hope I didn't misunderstand.
I like Code Grey. It's really very useful. We have to keep it that way.
I know #if ... and I use it, but it's not the same use.
The request of my message was the possibility to compile it or not in the .bin file.
JP _________________ pleasure to learn, to teach, to create |
|
Back to top |
|
|
Andreas_Schima
Joined: 13 Dec 2010 Posts: 2
|
|
Back to top |
|
|
albertsm
Joined: 09 Apr 2004 Posts: 5913 Location: Holland
|
Posted: Thu May 21, 2020 7:05 pm Post subject: |
|
|
Quote: | In fact I'm looking for an option to switch off "dead code detection", because it doesn't work properly. Is there a way to disable that feature? |
It seems to work ok for me.
i would recommend to read the help and the history.txt files.
The Dead Code option can be found under the Edit menu. In fact it has been mentioned on this forum too.
And the reason it does not work for your code is that you do not use the proper syntax. you use endif which should be END IF with a space.
if you enabled reformatting the endif will be corrected automatic into End If.
When you have cases where it does not work, check The Code Explorer. And if you find a real problem inform support about it so it can be changed. _________________ Mark |
|
Back to top |
|
|
Andreas_Schima
Joined: 13 Dec 2010 Posts: 2
|
Posted: Thu May 21, 2020 7:24 pm Post subject: |
|
|
albertsm wrote: | Quote: | In fact I'm looking for an option to switch off "dead code detection", because it doesn't work properly. Is there a way to disable that feature? |
It seems to work ok for me.
i would recommend to read the help and the history.txt files.
The Dead Code option can be found under the Edit menu. In fact it has been mentioned on this forum too.
And the reason it does not work for your code is that you do not use the proper syntax. you use endif which should be END IF with a space.
if you enabled reformatting the endif will be corrected automatic into End If.
When you have cases where it does not work, check The Code Explorer. And if you find a real problem inform support about it so it can be changed. |
Thank you for your immediate reply. Yes, I should have checked better.
Best Regards,
Andreas |
|
Back to top |
|
|
|