[Vala] Array Property Length Not Matching What I Expect




Okay, here is try number two at asking my question.  If you couldn't tell I am new to the mailing list world.
In
the code snippet below, I am attempting to read the length of an array
through a property.  For some reason the returned result is completely
random, but when I set a temporary variable to the value of the
property and read its length, it is correct.

Is there a problem in what I am doing, or is something else going on?

[CODE]public int main(){        string[] test_array, test2;     TestClass tc;   ulong len1, len2;             
  test_array = new string[100];   test_array[0] = "hello world";  tc = new TestClass(test_array);         
test2 = tc.rawr;        len1 = tc.rawr.length;  len2 = test2.length;
        stdout.printf("instance.property.length:\t\t%lu\n", len1);      
stdout.printf("string[].length:\t\t\t%lu\n", len2);             return (int)(len1 != len2);}
public class TestClass{ string[] inside_rawr;           public string[] rawr { get { return inside_rawr; } }  
          public TestClass(string[] r)    {               inside_rawr = r;        }}[/CODE]
Hopefully the formatting is correct this time.
Sam                                       


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]