Forum - MCS Electronics

 

FAQFAQ SearchSearch RegisterRegister Log inLog in

Problem in IDE version 2.0.8.0.006

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

Bascom Member



Joined: 27 May 2010
Posts: 319

blank.gif
PostPosted: Sun Apr 23, 2017 2:24 pm    Post subject: Problem in IDE version 2.0.8.0.006 Reply with quote

Hi,
The Code Explorer Window shows several instances of use of both arrays
(in this case 2, in my larger program up to 4).
Furhtermore, the first statement of Memcopy is grayed ("dead code"), if the same variable is used on the left side.
If I use different variable names, both statements are shown as used code.
Code:
$regfile = "Xm256a3def.dat"
Dim I_test As Word
Dim Null As Byte
Dim Array0(512) , Array1(512) As Integer
I_test = Memcopy(null , Array1(1) , 1024 , 2)
I_test = Memcopy(null , Array0(1) , 1024 , 2)
 

Is there a fix already available?
Compiler version :2.0.8.0
Compiler build :2.0.8.0.001
IDE version :2.0.8.0.006
Best regards, Meister

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

Bascom Member



Joined: 22 Aug 2009
Posts: 2262

blank.gif
PostPosted: Sun Apr 23, 2017 3:07 pm    Post subject: Re: Problem in IDE version 2.0.8.0.006 Reply with quote

Meister wrote:
Is there a fix already available?

Can't reproduce the described issues.
Besides, I'd suggest to check whether posted code compiles at all, maybe it helps you already to correct the erroneous "Dim"-line.
Back to top
View user's profile
Meister

Bascom Member



Joined: 27 May 2010
Posts: 319

blank.gif
PostPosted: Sun Apr 23, 2017 4:36 pm    Post subject: Re: Problem in IDE version 2.0.8.0.006 Reply with quote

MWS wrote:
Meister wrote:
Is there a fix already available?

Can't reproduce the described issues.
Besides, I'd suggest to check whether posted code compiles at all, maybe it helps you already to correct the erroneous "Dim"-line.

Hm, help me on the error.
It compiles (does following differ from the posted code? Should be the same...):
The first I_test=Memcopy... is grayed in the IDE.
$regfile = "Xm256a3def.dat"
Dim I_test As Word
Dim Null As Byte
Dim Array0(512) , Array1(512) As Integer
I_test = Memcopy(null , Array1(1) , 1024 , 2)
I_test = Memcopy(null , Array0(1) , 1024 , 2)

Regards, Meister
Back to top
View user's profile
EDC

Bascom Expert



Joined: 26 Mar 2014
Posts: 971

poland.gif
PostPosted: Sun Apr 23, 2017 7:14 pm    Post subject: Reply with quote

This is known issue and will be fixed (I hope) Very Happy
Mark explain this in third post in this topic Very Happy

https://www.mcselec.com/index2.php?option=com_forum&Itemid=59&page=viewtopic&t=13765&highlight=2080
Back to top
View user's profile Visit poster's website
Meister

Bascom Member



Joined: 27 May 2010
Posts: 319

blank.gif
PostPosted: Sun Apr 23, 2017 8:16 pm    Post subject: Reply with quote

EDC wrote:
This is known issue and will be fixed (I hope) Very Happy
Mark explain this in third post in this topic Very Happy

https://www.mcselec.com/index2.php?option=com_forum&Itemid=59&page=viewtopic&t=13765&highlight=2080

EDC, thanks for the hint. Although I am reading this Forum several times a day, I have missed or forgot that post.
So I am glad, that the produced code is unaffected by the unexpected gray coloring.
I had several issues of this in my longer program which I was not able to get rid of.

There is another issue that I mentioned in my original post:
Quote:
The Code Explorer Window shows several instances of use of both arrays

So, if an array is used a couple of times, the Code Explorer window shows the actual references up to 4 times (sometimes 2 times, 3 or 4 so far...)
Best regards, Meister
Back to top
View user's profile
MWS

Bascom Member



Joined: 22 Aug 2009
Posts: 2262

blank.gif
PostPosted: Sun Apr 23, 2017 8:38 pm    Post subject: Re: Problem in IDE version 2.0.8.0.006 Reply with quote

Meister wrote:
Hm, help me on the error.

Type of Array0 is not defined.
Back to top
View user's profile
Evert :-)

Bascom Expert



Joined: 18 Feb 2005
Posts: 2156

netherlands.gif
PostPosted: Sun Apr 23, 2017 9:01 pm    Post subject: Reply with quote

Think MWS is meaning this;
Dim Array0(512) , Array1(512) As Integer

I didn't know that is was allowed and that you have to do;
Dim Array0(512) As Integer , Array1(512) As Integer

Both option are compiling and work. However in the report you see a difference.
If you compile the way you did Array1 is stored before Array0 in the memory, what is a bit strange because normally the variable order in memory is the same order as they are dimmed. (except if you tell to do not)
When you compile it the way I suggested then Array0 is stored in memory before Array1, as expected.

So it's possible that the code explorer doesn't know yet Smile about this way of dimming. Maybe you can try if it will work, we can't with just a small piece of the code.

_________________
www.evertdekker.com Bascom code vault
Back to top
View user's profile Visit poster's website
Meister

Bascom Member



Joined: 27 May 2010
Posts: 319

blank.gif
PostPosted: Sun Apr 23, 2017 9:04 pm    Post subject: Re: Problem in IDE version 2.0.8.0.006 Reply with quote

MWS wrote:
Meister wrote:
Hm, help me on the error.

Type of Array0 is not defined.

If I do remember right, in 2078 or so "compact" diming was introduced.
I use it routinely.
Back to top
View user's profile
albertsm

Administrator



Joined: 09 Apr 2004
Posts: 5922
Location: Holland

blank.gif
PostPosted: Sun Apr 23, 2017 9:10 pm    Post subject: Reply with quote

DIM was extended to accept multiple variables separated by a comma like : dim a,b,c as byte in which case they all are dimmed as bytes.
And yes they end up in memory in reverse order. But how they end up does not really matter. You should not count on that.
Code that depends on place in memory is potential unsafe.

The dead code function was solved.

_________________
Mark
Back to top
View user's profile Visit poster's website
albertsm

Administrator



Joined: 09 Apr 2004
Posts: 5922
Location: Holland

blank.gif
PostPosted: Sun Apr 23, 2017 9:17 pm    Post subject: Reply with quote

I see this option did not made it to the help. I will add it.
_________________
Mark
Back to top
View user's profile Visit poster's website
MWS

Bascom Member



Joined: 22 Aug 2009
Posts: 2262

blank.gif
PostPosted: Sun Apr 23, 2017 9:50 pm    Post subject: Re: Problem in IDE version 2.0.8.0.006 Reply with quote

Meister wrote:
MWS wrote:
Meister wrote:
Hm, help me on the error.

Type of Array0 is not defined.

If I do remember right, in 2078 or so "compact" diming was introduced.
I use it routinely.

I've tried to compile above snippet and got the error message "... As missing", version 2080.
Back to top
View user's profile
EDC

Bascom Expert



Joined: 26 Mar 2014
Posts: 971

poland.gif
PostPosted: Mon Apr 24, 2017 3:00 pm    Post subject: Reply with quote

albertsm wrote:
Code that depends on place in memory is potential unsafe.


Ahahaha. Good that we can sometimes talk about programming and Evert point about this reverse placing in memory.
Actually I code something like PLC/timer for church bells Very Happy and program uses Time() function where you must have atleast three bytes in order.
Seconds->Minutes->Hours . If declared in new way - no suprise now - you get wrong output from Timestr = Time(Seconds) Very Happy

So this will be the first exeption Very Happy

BTW. My "byref" keyword is never highlighted Very Happy
I know that I dont need to place them but after hovering functions with Shift it is nice to see "byref" so I know how to pass variable.
Back to top
View user's profile Visit poster's website
albertsm

Administrator



Joined: 09 Apr 2004
Posts: 5922
Location: Holland

blank.gif
PostPosted: Mon Apr 24, 2017 6:36 pm    Post subject: Reply with quote

yes what would be the fun if there was no exception.
the best would be : dim b as byte , m as byte at b + 1 , h as byte at m + 1
this will make sure in any version that the memory is allocated after each other.

_________________
Mark
Back to top
View user's profile Visit poster's website
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