BUG: Order of Evaluation Change Between Native Code and P- CodeID: Q191616
|
A program appears to be incorrectly evaluating expressions, or evaluates differently between P-Code and Native Code with optimizations.
Visual Basic does not guarantee the order of evaluation in expressions when programs are compiled to native code with optimizations.
In a no-optimization case, the expression is evaluated left to right. In a optimized case, Visual Basic may change the order in which it evaluates expressions. A change in logic may be required to achieve the desired results.
Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article.
Dim Sample As String
Public Sub Main()
Dim Temp1 As String
While (get_String) And Not (Sample Like "*/*/*")
MsgBox "In loop --> " & Sample & " " & Not _
(Sample Like "*/*/*")
Wend
MsgBox "after --> " & Sample
End Sub
Function get_String() As Boolean
Sample = "09/19/97"
get_String = True
End Function
Additional query words: kbDSupport kbVBp600bug kbCompiler kbdss kbVBp kbVBp500bug
Keywords :
Version :
Platform : WINDOWS
Issue type : kbbug
Last Reviewed: June 17, 1999