Wassup Jose Weblog nonsense at its best!

1Aug/082

Convoluted Code

Honestly, what does this function do?

    Private Function VarN( _
    ByRef VarName As String, _
    Optional ByRef Value As Object = Nothing) _
    As Object
        On Error Resume Next

        Static aVarName() As Object
        Static aVarValue() As Object
        Dim iFound As Integer
        Dim ret As Object

        If IsNothing(Value) Then
            iFound = aFind(aVarName, VarName)
            If iFound > -1 Then
                ret = aVarValue(iFound)
            End If
        ElseIf Left(VarName, 1)  "~" Then
            If VarName = "A" Then
                ret = VB6.CopyArray(aVarName)
            ElseIf VarName = "B" Then
                ret = VB6.CopyArray(aVarValue)
            ElseIf VarName = "C" Then  'clear memvars
                Erase aVarName
                Erase aVarValue
            End If
        Else
            iFound = aFind(aVarName, VarName)
            If iFound = -1 Then
                aAdd(aVarName, VarName)
                aAdd(aVarValue, Value)
            Else
                aVarName(iFound) = VarName
                aVarValue(iFound) = Value
            End If
        End If

        Return ret

    End Function
Filed under: Blog Leave a comment
Comments (2) Trackbacks (0)
  1. Booooo!!!

  2. In addition to the obfuscated code, why the use of Objects for most variables?

    Cheese!


Leave a comment

(required)

 

No trackbacks yet.