Bug using array in script

Hi all,

I had trouble using array in a state machine or a program. This code :

var array myArray(10);
 
for (var int cpt = 0; cpt < 10; set cpt = cpt +1 )
{
    set myArray[cpt] = cpt;
}
can produce nan values, or even a segfault.

This code :

var array myArray(10);
 
for (var int cpt = 0; cpt < 10; set cpt = cpt +1 )
{
    set myArray[cpt] = 1.0*cpt;
}
seems to run well.

Bug using array in script

On Thursday 10 June 2010 18:47:00 nicolas [dot] mabire [..] ... wrote:
> Hi all,
>
> I had trouble using array in a state machine or a program.
> This code :
> &#10;&gt; var array myArray(10);&#10;&gt; &#10;&gt; for (var int cpt = 0; cpt &lt; 10; set cpt = cpt +1 )&#10;&gt; {&#10;&gt;     set myArray[cpt] = cpt;&#10;&gt; }&#10;&gt;
> can produce nan values, or even a segfault.
>
> This code :
> &#10;&gt; var array myArray(10);&#10;&gt; &#10;&gt; for (var int cpt = 0; cpt &lt; 10; set cpt = cpt +1 )&#10;&gt; {&#10;&gt;     set myArray[cpt] = 1.0*cpt;&#10;&gt; }&#10;&gt;
> seems to run well.
>

I'll create a bug report for this. Is this 1.8 or 1.10 ?

Peter

Bug using array in script

This is in 1.10. I did not made the test for other releases.

Nicolas.

Bug using array in script

This is in 1.10. I did not made the test for other releases.

Nicolas.

Bug using array in script

Hi all,

I had trouble using array in a state machine or a program.
This code :
&#10;var array myArray(10);&#10;&#10;for (var int cpt = 0; cpt &lt; 10; set cpt = cpt +1 )&#10;{&#10;    set myArray[cpt] = cpt;&#10;}&#10;
can produce nan values, or even a segfault.

This code :
&#10;var array myArray(10);&#10;&#10;for (var int cpt = 0; cpt &lt; 10; set cpt = cpt +1 )&#10;{&#10;    set myArray[cpt] = 1.0*cpt;&#10;}&#10;
seems to run well.