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


User bmarcelly changed the following:

                What    |Old value                 |New value
================================================================================
                      CC|''                        |'bmarcelly'
--------------------------------------------------------------------------------




------- Additional comments from [email protected] Mon Mar 30 19:29:25 
+0000 2009 -------
Remarks on this Issue.

The anomaly comes from the handling of Private variables in OOoBasic.

A) Without special option, Private variables are in fact Public ! (see Issue 
17948)

Proof : if you change in module2 the declaration to :
public a1 as integer
you have exactly the same result, wrong message and no error.
I would not say it's a Basic bug, because there are two public declarations on 
the 
same variable; the last one is used. It's a programmer bug.

If you really want to use Private variables you must use a special option: see 
solutions B) and C)

B) Keep private a1 in module2 and change module1 like this:

Option Explicit
public a1 as String

Sub Main
        CompatibilityMode(True)  ' enforce Private variable handling
        a1 = "Hello Module1"
        msgbox a1              'error, it returns 0
End Sub
then you get a runtime error : undefined variable. 
This is in my opinion the only real bug. It should display Hello Module1.

C) Another option is the VBA mode (which includes the same correction of 
OOoBasic). 
Change module1 to this:

Option Explicit
Option VBASupport 1  ' use VBA compatibility mode

public a1 as String

Sub Main
        a1 = "Hello Module1"
        msgbox a1              'error, it returns 0
End Sub
then you get the same incorrect runtime error : undefined variable. 

---------------------------------------------------------------------
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