Static variables

Am I overlooking something why does "static" only work for global var and not for local var?
 

static int i = 0
void test()
{
    print i "\n"
        i++
}
test()
test()
 
output
0
1

 

void test()
{
    static int i = 0
        print i "\n"
        i++
}
test()
test()
 
output
0
0



-Jim



 


SystemAdmin - Thu Mar 14 09:38:07 EDT 2013

Re: Static variables
Mathias Mamsch - Thu Mar 14 13:40:28 EDT 2013

Well maybe this is because, the static keyword is not implemented and your code is written, so it will also work with a normal global variable. You don't need a static variable in DXL. Use a global variable with a unique name, that you use only from that function. Regards, Mathias


Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS