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

--- Comment #4 from Joshua Coppersmith <[email protected]> ---
Looking at the following

Sub StartUp1()
        Dim Passed(1 To 2) As Variant
        FuncBug1(Passed)
End Sub
Function FuncBug1(Passed() As Variant)
        Dim LocalDimmed(1 To 2) As Variant
        'LocalDimmed(1, 1) = 42 'Will not compile for a locally Dimmed array
        Passed(1, 1) = 42 'Compiles and works, ignoring 2nd index
        MsgBox Passed(1, 1, 404, "Hi, how are you?") 'Shows 42
End Function

we see--as a fun side note--that passed arrays may not even generate a runtime
error with mismatched dimensions. This is harmless because when accessed with
too many indices the code works, but when accessed with too few indices the
runtime generates an 'Index out of defined range' error.

Quirkiness aside, this leads to the question: Should an array passed to a
function even be checked for dimension count at all at compile time if that
makes no claims about operation at runtime? I get that the scoping issue would
still exist for locally Dimmed arrays, but I am just wondering about the
philosophy of issuing compile-time errors on things that can't really be
checked statically anyway.

-- 
You are receiving this mail because:
You are the assignee for the bug.

Reply via email to