mlimber wrote:
pauldepst...@att.net wrote: I am writing code to price some financial options using recursive
functions.
It compiles but I get a runtime error which is caused by a memory
violation.
The problem is that the code is much too long to be suitable for
inclusion in this posting, and I don't know where the problem lies.
If anyone does have the time/willingness/extreme kindness to help me, I
would think that the simplest thing would be for them to get in touch
with me at pa**********@yahoo.com
I can be reached by yahoo IM also. My yahoo ID is pauldepstein.
If anyone feels they could help me but only on a paid basis, please let
me know and we'll try and work something out.
Thank you,
Paul Epstein
Have you run through the program in your debugger? Can you boil it down
to a simple but complete example that demonstrates the same problem?
See this FAQ on posting code:
http://parashift.com/c++-faq-lite/ho...t.html#faq-5.8
Wild guess: you're overflowing your stack because of repeated
recursion. Try enlarging the stack size (perhaps in the project
settings if you're using an IDE, or maybe via a command line tool in
some flavor of unix).
Cheers! --M
Thank you, M limber!
I think your "wild guess" is probably correct. Here is more info on
the code: I set a variable J using a function which is a member of the
parameters class.
I then access J in several places and inside recursive functions using
the line: int J = params_ptr->get_int("J");
if (!strncmp (in_string, "J", 100)) {return J; } is part of the
get_int function.
This accessing of J seems to work going through the loop a few times
but not on the sixth.
So your "guess" is very helpful.
I am very much a newbie and have no idea how to enlarge the stack size.
The IDE is dev c++. Of course, I would be happy to research the topic
of stack-size-enlarging-using-Dev-c++ independently. (I will google it
immediately after this posting.) I merely mention my ignorance of
this, by way of reply to your advice.
Thank you,
Paul Epstein