Re: ByRef v ByVal
From: Larry Serflaten (serflaten_at_usinternet.com)
Date: 08/02/04
- Next message: Mark: "Re: GDI Leak"
- Previous message: Norm Cook: "Re: inf file"
- In reply to: Tony Proctor: "Re: ByRef v ByVal"
- Next in thread: J French: "Re: ByRef v ByVal"
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 2 Aug 2004 08:54:39 -0500
"Tony Proctor" <tony_proctor@aimtechnology_NOSPAM_.com> wrote
> Re-reading the ping-pong replies so far suggests (to me) that you
> both know what "aliasing" is, and why it affects compiler optimisation, but
> are simply describing it in different ways.
...
> For the record: aliasing is a situation where two or more variables
> reference the same physical location in memory.
...
> For instance: the same value being passed via 2 different
> arguments to the same procedure, or even a variable with global scope being
> passed via 1 argument.
Where do you see anything about using two differnt variables in his statement:
Passing a parameter using a ByRef is called "aliasing"
His position was, simply using ByRef on a procedure parameter was cause
enough not to check that box. Do you agree with that position? That is what
he said, MS's caution was about:
"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."
Keep in mind, it is not the passing of the variable (global or not) that is the
problem, it is accessing the same memory location in two different ways, inside
a procedure that can cause problems. So even passing in a global variable will
not be a problem if the global variable itself is not used in the routine. In that
manner, simply passing in a variable ByRef is not a problem, and contrary to
what he said, it is not called aliasing (as indicated by the optimizing switch).
LFS
- Next message: Mark: "Re: GDI Leak"
- Previous message: Norm Cook: "Re: inf file"
- In reply to: Tony Proctor: "Re: ByRef v ByVal"
- Next in thread: J French: "Re: ByRef v ByVal"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|