[Libreoffice-bugs] [Bug 136467] Regression on Basic Iif() function

bugzilla-daemon at bugs.documentfoundation.org bugzilla-daemon at bugs.documentfoundation.org
Sun Sep 6 01:59:01 UTC 2020


https://bugs.documentfoundation.org/show_bug.cgi?id=136467

Aron Budea <baron at caesar.elte.hu> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
           Keywords|bibisectRequest, regression |bibisected, bisected
         Resolution|---                         |NOTABUG
                 CC|                            |baron at caesar.elte.hu

--- Comment #7 from Aron Budea <baron at caesar.elte.hu> ---
(In reply to Alain Romedenne from comment #0)
> Description:
> Iif(condition, expression1, expression2) evaluates BOTH expressions before
> execution. Exceptions can be raised unconditionnally.
I don't think this is a regression. In fact, I don't think it's a bug, I
haven't found a reference to StarBasic, but VBA has the same function:
https://docs.microsoft.com/en-us/office/vba/language/reference/user-interface-help/iif-function

This states:
"IIf always evaluates both truepart and falsepart, even though it returns only
one of them. Because of this, you should watch for undesirable side effects.
For example, if evaluating falsepart results in a division by zero error, an
error occurs even if expr is True."

Further note on the change that happened in 6.3:
> e.g.
> Sub _inverse_
> 	Print Iif(x=0,0,1/x)
> End Sub
If you do it like this, there's been a division by zero in older versions as
well:
x=0
Print Iif(x=0,0,1/x)

The difference in the evaluation of the original sample came with the following
commit:
https://cgit.freedesktop.org/libreoffice/core/commit/?id=15c39bb2e75df40c30bcbf789d815376dd2e31ce
author          Eike Rathke <erack at redhat.com>  2019-05-02 20:54:16 +0200
committer       Eike Rathke <erack at redhat.com>  2019-05-02 22:35:35 +0200

Resolves: tdf#124605 ditch "if operand 1 is Empty, result is operand 2"

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/libreoffice-bugs/attachments/20200906/1f9df43d/attachment-0001.htm>


More information about the Libreoffice-bugs mailing list