Hi Jens -

Good to hear from you. The semantics of forall loops changed
in version 1.11 -- see
 http://chapel.cray.com/docs/master/language/evolution.html#forall-intents

In particular, with your example


>$ cat main.chpl 
>config const n = 100000;
>
>
>proc main() {
>    var temp : int = 0;
>    temp = 1;
>    forall i in {1..n} do {
>        if (i == 0) {
>            temp = 1;
>        }
>    }
>
>
>    writeln("temp = ", temp);
>}

you would have to write it this way

forall i in 1..n with (ref temp) {

}

to write that program since the default is to
copy integer variables into a forall loop (so
that they are read-only (rvalues) within the
loop).

Note also that the do before a curly brace
(as in  for i in 1..10 do {    )

and the curly braces around the 1..n
(as in  for i in {1..10}   )

are unnecessary. I tried to write the forall
loop in better style in my example above.

Cheers,

-michael


------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140
_______________________________________________
Chapel-bugs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/chapel-bugs

Reply via email to