https://issues.apache.org/ooo/show_bug.cgi?id=88491

Bob <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |[email protected]

--- Comment #3 from Bob <[email protected]> ---
I was about to open a very similar bug report and can provide a simple test
case to demonstrate the problem still occurs of OO 4.1.0

VBA allows an optional parameter to be defined as - optional str as string =
"abc" - the variable is not initialized to "abc" in OO

Alternatively if no default is provided - optional mstr as string mstr  -
should not be initialized and isMissing(mstr) should return True it actually
returns false and mstr is a null string

OO works correctly for data type Double and Variant,  I have not tested other
data types

This error is particularly insidious when porting from Excel since no error is
raised and differences in function execution may not be readily apparent.

I used the following function to show the problem:

function TestOpt(optional num as double =123,  optional str as string = "abc",
optional numv  =456,  optional strv = "def", optional miss as double, optional
mstr as string) as string 
Dim printstr as string 

printstr =              "num: >>" &num &"<<  isMissing " & isMissing(num) 
printstr = printstr & "; str: >>" &str &"<<  isMissing " & isMissing(str) 

printstr = printstr & "; numv: >>" &numv &"<<  isMissing " & isMissing(numv) 
printstr = printstr & "; strv: >>" &strv &"<<  isMissing " & isMissing(strv)
rem print printstr
printstr = printstr & "; miss: >>" &miss &"<<  isMissing " & isMissing(miss)
printstr = printstr & "; mstr: >>" &mstr &"<<  isMissing " & isMissing(mstr)
print printstr
TestOpt = printstr
end function 

Output is 
num: >>123<<  isMissing False; str: >><<  isMissing False; numv: >>456<< 
isMissing False; strv: >>def<<  isMissing False; miss: >>Error ǀ<<  isMissing
True; mstr: >><<  isMissing False

str and mstr are handled incorrectly, other formats are correct

-- 
You are receiving this mail because:
You are on the CC list for the issue.
You are the assignee for the issue.
You are watching all issue changes.

Reply via email to