Share via


Visual Basic Concepts

Assume No Aliasing

Tells the compiler that your program does not use aliasing.

An alias is a name that refers to a memory location that is already referred to by a different name. This occurs when using ByRef arguments that refer to the same variable in two ways. For example:

Sub Foo(x as integer, y as integer)
   x = 5   ' Code is referring to the same variable
         ' (the local z in Main)
   y = 6   ' via two different names, x and y.
End Sub
Sub Main
   Dim z as integer
   Foo z,z
End Sub

Using this option allows the compiler to apply optimizations it couldn't otherwise use, such as storing variables in registers and performing loop optimizations. However, you should be careful not to check this option if your program passes arguments ByRef, since the optimizations could cause the program to execute incorrectly.