PRB: Arguments Are Evaluated from Right to Left in Some Cases (138519)
The information in this article applies to:
- Microsoft Visual Basic Standard Edition, 32-bit, for Windows 4.0
- Microsoft Visual Basic Professional Edition, 16-bit, for Windows 4.0
- Microsoft Visual Basic Professional Edition, 32-bit, for Windows 4.0
- Microsoft Visual Basic Enterprise Edition, 16-bit, for Windows 4.0
- Microsoft Visual Basic Enterprise Edition, 32-bit, for Windows 4.0
This article was previously published under Q138519 SYMPTOMS
Visual Basic 4.0 allows you to pass a variable number of arguments to a
subroutine or function by using a parameter array (ParamArray). Although,
arguments passed to another function or subroutine are evaluated from right
to left when a parameter array is used in the 32-bit version, the 16-bit
version evaluates arguments from left to right when a parameter array is
used.
Arguments are evaluated from left to right if a set number of arguments is
passed to a function or subroutine in both the 16-bit and 32-bit versions.
Arguments are evaluated from right to left when using the switch function
in both the 16-bit and 32-bit versions of Visual Basic.
WORKAROUND
Code that relies on the order of evaluation of arguments passed to another
function is dangerous code in any language. To correct code that fails
because of the order of evaluation, Microsoft recommends that arguments be
explicitly calculated before being passed to a function or subroutine.
STATUS
This behavior is by design.
Modification Type: | Major | Last Reviewed: | 12/9/2003 |
---|
Keywords: | kbprb kbprogramming KB138519 |
---|
|