To comment on the following update, log in, then open the issue:
http://www.openoffice.org/issues/show_bug.cgi?id=58089


User jsk changed the following:

                  What    |Old value                 |New value
================================================================================
                    Status|UNCONFIRMED               |RESOLVED
--------------------------------------------------------------------------------
                OS/Version|Windows XP                |All
--------------------------------------------------------------------------------
                Resolution|                          |WORKSFORME
--------------------------------------------------------------------------------
          Target milestone|---                       |OOo Later
--------------------------------------------------------------------------------




------- Additional comments from [EMAIL PROTECTED] Mon Jan  2 01:16:34 -0800 
2006 -------
Hi Frahan,

thank you for supporting OOo! 

I believe you are making incorrect use of the static keyword. In your sample the
variable is reinitialized each time the sub is executed, reverting the value of
x to "undefined" (no value assigned turns out to be 0). I have provided a sample
where the variable is initialized only once (call to sub with iMode = 1). In
this sample the static variable keeps its value as expected.

Sub Main

    test1 ( 1 )
    test1 ( 3 )
    test1 ( 2 )
    test1 ( 3 )
    
End Sub

sub test1( iMode as integer )

    select case iMode
    case 1 : 
        static x as integer
        x = 1
        print "X initialized as: " & x 
    case 2 :
        x = 2
        print "X assigned: " & x
    case 3 :
        print "X = " & x
    end select
    
end sub

I set the issue to WorksForMe and close it. Please note that you may reopen the
issue in case you do not agree. I tested Linux and Windows.

Regards,
joerg

---------------------------------------------------------------------
Please do not reply to this automatically generated notification from
Issue Tracker. Please log onto the website and enter your comments.
http://qa.openoffice.org/issue_handling/project_issues.html#notification

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to