I am developing a program which is recursive in nature (functionA can call
itself or several other functions: functionB, functionC, and functionD --
and each of these functions may call itself or one of the other functions).
Sometimes when an exception is thrown, the program stops and I get an error
message:
Thread Stopped
Fault access violation at 0x50000: write of
address 0x7554ac73
The 0x50000 is the same every time I get the error.
The error goes away if I compile the code without enabling destructor
cleanup (which is one of the compiler options under Exception Handling/
RTTI).
I have checked my code, all of the local variables are simple types (or
pointers to complicated types) so I don't see how any of my destructors
would be called (and when I trace through the code, I dont get to any of my
destructor code). None of my destructors are inline functions.
If anybody has an ideas about my mistakes or compiler bugs, I'd be greatful
for any suggestions.
Thanks in advance,
Jon Jay
It's very easy to write a recursive function that runs out of stack space.
First give your program more stack space (see linker options). If that
doesn't help, analyze your code - you're probably not controlling the depth
of your recursion properly. When writing a recursive algorithm, you MUST
analyze the code so that you know (it's "determinant") the maximum recursion
depth of your algorithm...this MUST be "bounded" or you will "always" run
out of stack space and crash. This is a common and frustrating mistake many
people make when first writing a recursive algorithm.
Matthew Ratcliff
TeamB Developer Support
76711...@compuserve.com
Jon Jay wrote in message
<01bd2e7e$222d6800$35ab...@u.washington.edu.u.washington.edu>...
>
>I am developing a program which is recursive in nature (functionA can call
>itself or several other functions: functionB, functionC, and functionD --
>and each of these functions may call itself or one of the other functions).
>
I know these aren't very nice workarounds, but I haven't seen a case
that couldn't be worked around by at least one of these methods.
We are aware of these problems and are addressing them.
-edj
Ed James-Beckham wrote in message <34d76d2c.8010837@forums>...
Are you actually using 5.02 in conjunction with builder right now? I
am, and have been quite successfully. Err, um well with the exception
of exceptions. It seems that your experience with them although
problematic is substantially better than mine. I cannot get them to
work in my BC5 generated DLL at all. My project is a builder generated
GUI executable and a BC5.02 generated DLL. I have never been able to
get any part of the DLL code to throw and catch an exception. Any
suggestions.
howa.
> You can't expect a patch to BC 5.02 for this. It should be available in
> the next C++Builder however.
Why not?
Tom Carlson
FCPA