Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Problems with Exceptions, BC5.02

16 views
Skip to first unread message

Jon Jay

unread,
Feb 2, 1998, 3:00:00 AM2/2/98
to

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


Matthew Ratcliff

unread,
Feb 2, 1998, 3:00:00 AM2/2/98
to

>>>
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).
<<<

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

Mark Mathews

unread,
Feb 3, 1998, 3:00:00 AM2/3/98
to

Exception handling has bugs in 5.02 and there has never been a fix (I've
been waiting months). The most common symptom is destructors being called
for objects who's constructor has not been called. You can avoid the problem
by turning off destructor clean-up, but that sort defeats the purpose of
using exception handling. The only other option is to go back to 5.01, or
buy a compiler that properly supports C++ exception handling (I long for the
good ole days when that used to be Borland). As you can see I am extremely
frustated over Borland's horrendous support. I've been able to duplicate
this problem in C++Builder as well, but I guess the RAD crowd doesn't know
how to use exception handling anyway, so who gives a hoot.


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).
>

Ed James-Beckham

unread,
Feb 3, 1998, 3:00:00 AM2/3/98
to

For this type of problem you can also try one or all of these
workarounds:
Turn on out-of-line inline functions (-vi-)
Make sure all classes have a ctor and dtor that you've defined
Eliminate temporaries where you can.

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

Mark Mathews

unread,
Feb 4, 1998, 3:00:00 AM2/4/98
to

Ed, can you give some feedback on how soon we can expect this problem to be
resolved? It has forced my organization to go back to 5.01 and prevents us
from being able to utilize C++Builder to the extent we were planning. I
filled a bug report months ago (ref 13769) and was told then that the
problem was being looked into. Since then I've heard nothing other than a
occasional "we're looking into it" when I pitch a fit. I'm at a point where
I need to make some project decisions, so any heads-up you can give me would
be appreciated.

Ed James-Beckham wrote in message <34d76d2c.8010837@forums>...

Ed James-Beckham

unread,
Feb 5, 1998, 3:00:00 AM2/5/98
to

Well, we are always fixing bugs. Often bugs occur in more than one
spot, so we may not fix all cases. You can't expect a patch to BC
5.02 for this. It should be available in the next C++Builder however.
Since this is my area of expertise, if you want to send me an
example of your code that fails in this way, I will be glad to run it
through the latest of the latest and let you know what happens. If it
doesn't work, we'll have another bug to work on. :)
Please note that if you do send me some code, send it in a command
line form (IOW, no .IDE, but rather a makefile).
-edj

ho...@iconetworks.com

unread,
Feb 8, 1998, 3:00:00 AM2/8/98
to

Mark

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.

Tom Carlson

unread,
Feb 16, 1998, 3:00:00 AM2/16/98
to ed...@ix.netcom.com

Ed James-Beckham wrote:

> 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


0 new messages