View previous topic :: View next topic |
Author |
Message |
Meister
Joined: 27 May 2010 Posts: 319
|
Posted: Sun Apr 23, 2017 2:24 pm Post subject: Problem in IDE version 2.0.8.0.006 |
|
|
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 |
|
|
MWS
Joined: 22 Aug 2009 Posts: 2262
|
Posted: Sun Apr 23, 2017 3:07 pm Post subject: Re: Problem in IDE version 2.0.8.0.006 |
|
|
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 |
|
|
Meister
Joined: 27 May 2010 Posts: 319
|
Posted: Sun Apr 23, 2017 4:36 pm Post subject: Re: Problem in IDE version 2.0.8.0.006 |
|
|
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 |
|
|
EDC
Joined: 26 Mar 2014 Posts: 971
|
|
Back to top |
|
|
Meister
Joined: 27 May 2010 Posts: 319
|
Posted: Sun Apr 23, 2017 8:16 pm Post subject: |
|
|
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 |
|
|
MWS
Joined: 22 Aug 2009 Posts: 2262
|
Posted: Sun Apr 23, 2017 8:38 pm Post subject: Re: Problem in IDE version 2.0.8.0.006 |
|
|
Meister wrote: | Hm, help me on the error. |
Type of Array0 is not defined. |
|
Back to top |
|
|
Evert :-)
Joined: 18 Feb 2005 Posts: 2156
|
Posted: Sun Apr 23, 2017 9:01 pm Post subject: |
|
|
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 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 |
|
|
Meister
Joined: 27 May 2010 Posts: 319
|
Posted: Sun Apr 23, 2017 9:04 pm Post subject: Re: Problem in IDE version 2.0.8.0.006 |
|
|
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 |
|
|
albertsm
Joined: 09 Apr 2004 Posts: 5913 Location: Holland
|
Posted: Sun Apr 23, 2017 9:10 pm Post subject: |
|
|
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 |
|
|
albertsm
Joined: 09 Apr 2004 Posts: 5913 Location: Holland
|
Posted: Sun Apr 23, 2017 9:17 pm Post subject: |
|
|
I see this option did not made it to the help. I will add it. _________________ Mark |
|
Back to top |
|
|
MWS
Joined: 22 Aug 2009 Posts: 2262
|
Posted: Sun Apr 23, 2017 9:50 pm Post subject: Re: Problem in IDE version 2.0.8.0.006 |
|
|
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 |
|
|
EDC
Joined: 26 Mar 2014 Posts: 971
|
Posted: Mon Apr 24, 2017 3:00 pm Post subject: |
|
|
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 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)
So this will be the first exeption
BTW. My "byref" keyword is never highlighted
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 |
|
|
albertsm
Joined: 09 Apr 2004 Posts: 5913 Location: Holland
|
Posted: Mon Apr 24, 2017 6:36 pm Post subject: |
|
|
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 |
|
|
|