Board index » cppbuilder » CodeGuard/Compiler/Windows error or bug I am not sure

CodeGuard/Compiler/Windows error or bug I am not sure

I am not sure if this is a bug or error in my part, but if I run my
application(.exe) without the compiler, without checking CodeGuard on, I get
an error which says, Invalid Access of memory location bla...bla...bla....at
address.....bla....bla....bla.....
Now same application, I run it under the compiler, no problems, no errors,
everything is peachy.  If I enable CodeGuard and I am running it from the
compiler, neither the compiler nor CodeGuard report any errors or warnings
of any kind.  (By the way, I am running Borland C++ 5.0 professional.)
Now same application, I enable CodeGuard, I compile or makefile, the create
a new (.exe), now the problem does not present itself.
What is going on, why does my application report an error, while is running
by itself and without CodeGuard support, but runs perfectly under the
compiler????????

Thank you,
Neil P.

 

Re:CodeGuard/Compiler/Windows error or bug I am not sure


Quote
On Fri, 21 Sep 2001 14:20:27 -0400, "Neil P." <nporv...@hotmail.com> wrote:
>Invalid Access of memory location
>What is going on, why does my application report an error, while is running
>by itself and without CodeGuard support, but runs perfectly under the compiler?

Possibly due to use of an uninitialized local variable, most likely a pointer.
When debug is used, variables may be initialized to a specific value by
the de{*word*81} to aid it in tracking accesses. When running as a free-standing
program, uninitialized local variables will have random values. This can
cause pointers to access memory outside of the program's address space.

Another possible explanation is that when debugging code is included,
memory locations of various parts of your program may be different
than without debugging. Also, debugging/tracking code occupies
memory within your program's address space. Memory overwrites
caused by invalid pointers may affect different memory locations
than when no debugging code is activated. i.e. - Without debug
code, a wild pointer may cause a memory access *outside* the
program's address space resulting in an AV. With debug code
included, the same wild pointer may still cause an incorrect memory
access, but the location of that access may now fall somewhere
*within* the program's address space so no AV occurs.

One would hope that analyzers/de{*word*81}s such as CodeGuard would
catch *all* such errors, but unfortunately it isn't always the case.

--
Wayne A. King
(ba...@torfree.net, wayne.k...@ablelink.org,
 wak...@idirect.com, Wayne_A_K...@compuserve.com)

Other Threads