Hi,

I have a piece of code (attached below). The code doesn't compile with C++ 
backend and gives the following error:

x10c++: In file included from actualtest.cc:4:
     actualtest.inc: In member function ‘void actualtest__closure__1::apply()’:
     actualtest.inc:33: error: invalid use of member (did you forget the ‘&’ ?)
     actualtest.inc:33: error: invalid use of member (did you forget the ‘&’ ?)
x10c++: Non-zero return code: 1
2 errors.

With Java backend the code compiles and runs, but randomly gives exceptions of 
the form:

java.lang.ArrayIndexOutOfBoundsException
        at java.lang.System.arraycopy(Native Method)
        at x10.core.GrowableRail.grow(GrowableRail.java:81)
        at x10.core.GrowableRail.add(GrowableRail.java:46)
        at x10.util.ArrayList.add(ArrayList.java:175)
        at actualtest$1.apply(actualtest.java:108)
        at x10.lang.Activity.run(Activity.java:169)
        at x10.lang.Runtime$Worker$3.apply(Runtime.java:3222)
        at x10.runtime.impl.java.Runtime.runAt(Runtime.java:101)
        at x10.lang.Runtime$Worker.loop(Runtime.java:3189)
        at x10.lang.Runtime$Worker.apply(Runtime.java:3077)
        at x10.lang.Runtime$Pool$1.apply(Runtime.java:3408)
        at x10.runtime.impl.java.Thread$1.run(Thread.java:36)
        at java.lang.Thread.run(Thread.java:619)

Any help is appreciated.

The code:
---------------------------------------

import x10.util.*;

class testIt {
  public var i:Int;

  public def this(ii:Int) { i = ii; }
}

public class actualtest {
    public def this() { }
    public def make() {
        val strs = new ArrayList[testIt]();

        finish for(var i:Int=0; i<100; i++) {
            val ii = i;
            async { strs.add(new testIt(ii)); };
        }

        finish foreach(s in strs) x10.io.Console.OUT.println((s as 
testIt{self.at(this)}).i);
    }

    public static def main(args:Rail[String]!) : void {
        new actualtest().make();
    }
}

---------------------------------------------



In the beginning there was nothing. God said, 'Let there be light!' And there 
was light. There was still nothing, but you could see it a whole lot better.
- Ellen DeGeneres


      The INTERNET now has a personality. YOURS! See your Yahoo! Homepage. 
http://in.yahoo.com/

------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
_______________________________________________
X10-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/x10-users

Reply via email to