It is currently Thu, 25 Feb 2021 06:13:06 GMT



 
Author Message
 help needed in Segmentation fault SIGSEGV
Hello everyone. I am new to C++ and STL. As a part of my practice, I
am trying to implement a class called LongNumber. Its purpose is to
create and perform high precision, arithmetic operations on very large
numbers. It uses a linked list (STL list) to store very large (e.g.:
100!) numbers; single character in each node of the link list and an
integer lsd_power is used to denote it's power.

E.g.: -252200.23 is represented as lsd_power = -2 and link list will
contain characters 25220023 and a Boolean variable negative will be
set to true.

I am overloading +, _ and * operators to perform the arithmetic.

The program works perfectly when i try to perform the arithmetic
operations on few large numbers, but it crashes when i tried on many
large numbers. I created a file and entered few expressions in the
form:

number1 operation number2 (eg: 10222222.32 * -1236565.3)

The program reads from this input file and writes output in the form:

number1 operation number2 = result

to an "output" file.
there are about 50 such entries in the input file. It works perfectly
for about first 20 - 25 expression and then the program crashes
saying:

Program received signal SIGSEGV, Segmentation fault

I really don't understand what is going wrong. I tried checking
everything. Please help me. I would really appreciate if u could look
into my code. drop me a mail at  harke...@nepalimail.com and i'll mail
u the code.



 Sat, 30 Jul 2005 23:27:26 GMT   
 help needed in Segmentation fault SIGSEGV

The problem is most likely related to the way you read
the input. You probably corrupt memory in the process.

You can cut out everything except the input and see
if it still crashes. If your error doesn't become obvious
to you when you have a 20-line test case, post it and your
bug will be revealed to you.

Other things to try: valgrind, efence, mpatrol ...

Cheers,
--
In order to understand recursion you must first understand recursion.



 Sun, 31 Jul 2005 00:05:11 GMT   
 
   [ 2 post ] 

Similar Threads

1. Segmentation fault need help

2. Segmentation Fault in printing: Urgent help needed!!

3. Need help [Oops; Segmentation Fault at shutdown]

4. help needed with segmentation faults with 3D

5. rxvt-2.17 Segmentation fault - Need Help !

6. Help needed in debugging a C++ program which crashes saying Segmentation fault

7. HELP needed RE: Segmentation fault (11)


 
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software