|
|
|
A procedure is said to contain aliased values if it can refer to the same memory addresses in two or more distinct ways. A typical example is the following procedure: |
If this procedure is passed the g_GlobalVariable, it is able to modify that variable in two ways, through a direct reference and through the x parameter. Another common variant of aliased values occurs when a procedure expects multiple arguments, and you pass the same variable to two or more of them. Aliases values are often the effect of poor programming practice, but they are also harmful to optimization. In fact, if you are absolutely sure that your app never makes use of aliased variables, you can turn on the "Assume No Aliasing" advanced compile option. This option informs the compiler that no procedure is able to modify the same memory locations, which enables the compiler to generate more efficient assembly code. More specifically, the compiled program will try to cache the value of those variables into CPU registers, which sensibly speeds up execution.
Summarizing, you don't have aliased value when: (1) the procedure doesn't refer to any global variable, (2) if the procedure refers to global variables, you never pass the same variable as a ByRef argument to the procedure, (3) if the procedure expects multiple ByRef arguments, you never pass the same variable in two or more of them.
|
|
|
|
Submitted By :
Nayan Patel
(Member Since : 5/26/2004 12:23:06 PM)
|
|
|
Job Description :
He is the moderator of this site and currently working as an independent consultant. He works with VB.net/ASP.net, SQL Server and other MS technologies. He is MCSD.net, MCDBA and MCSE. In his free time he likes to watch funny movies and doing oil painting. |
View all (893) submissions by this author
(Birth Date : 7/14/1981 ) |
|
|