Inaccesible value

can anyone tell me what is causing the variable become inccesible value
Explorer060599Asked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
lzConnect With a Mentor Commented:
When optimization is turned on, the compiler does things
that are not obvious from the pascal lines you have written. For example, when you use a local variable only in the first
three lines of a procedure that is 20 lines long, the
compiler might detect that this value is not required
any more (altough YOU might want to see in the debugger)
and could (for example) re-use the processor register that
where it was stored for some other variable. In reality,
this is far more complex than this example, and cannot be easily predicted. The same applies for variables that go out of scope: the compiler does not need them as long as they are out of scope, so the code to make them available might
be removed by the compiler.
The one and only solution (applies to all compilers with
optimization, not just delphi): Turn optimization off
while debugging! In fact, optimized code can be so
complex to "understand" that debuggers sometimes
even have real problems when trying to step through optimized code (missing breakpoints etc.). You will
also see that you have much more "blue dots" where you
can place a breakpoint when optimization is off.

0
 
CalvinDayCommented:
I have this problem when optimization is turned on. Trying to view a variable that has gone out of scope will also do this.
0
All Courses

From novice to tech pro — start learning today.