Segmentation Fault

Let's talk about algorithms!

Moderator: Board moderators

Post Reply
fran
New poster
Posts: 7
Joined: Fri May 14, 2004 3:07 am

Segmentation Fault

Post by fran »

hello to all!, could anybody tell me how to avoid the run time error: "segmentation fault" when I run my programs, they work perfectly under windows. :cry:
thank you.
Dominik Michniewski
Guru
Posts: 834
Joined: Wed May 29, 2002 4:11 pm
Location: Wroclaw, Poland
Contact:

Post by Dominik Michniewski »

Check carefully pointers (if you use it) or how can you index arrays ... This two reasons causes most of such errors :-)

Best regards
DM
If you really want to get Accepted, try to think about possible, and after that - about impossible ... and you'll get, what you want ....
Born from ashes - restarting counter of problems (800+ solved problems)
fran
New poster
Posts: 7
Joined: Fri May 14, 2004 3:07 am

Post by fran »

I have this problem when I use STL's vectors, maps, etc.
I suppose I should control their sizes...
thanks :roll:
fran
New poster
Posts: 7
Joined: Fri May 14, 2004 3:07 am

Post by fran »

I have this problem when I use STL's vectors, maps, etc.
I suppose I should control their sizes...
thanks :roll:
jagadish
Learning poster
Posts: 90
Joined: Mon Feb 16, 2004 8:53 pm
Location: Bangalore INDIA

Post by jagadish »

the simplest solution is to use GCC compiler to check your code before submiting .. u may then use gdb to step through the code
to exactly know which statement results in segmentation fault
if u can think of it .. u can do it in software.
Pavl0
New poster
Posts: 16
Joined: Sun Apr 18, 2004 2:57 pm

Post by Pavl0 »

in stl you must resize tables,vectors etc. some times j think :roll:
but j don't know execly becose j don't use stl

but if you use normal table[12] end your prog will call table[19] it will be segmentation
Alessandro
New poster
Posts: 27
Joined: Mon Jun 14, 2004 10:33 pm
Location: Latina, Italy

Post by Alessandro »

Simple solution: throw Windows out of the window and install Linux! I used Windows for years, now I think a true programmer can't bear with its lack of trasparence. Linux is full of instruments and utilities for a programmer.

I just use gcc/gdb/gprof from the shell...

(Sorry if I made some mistakes with the language)

Ale
Alessandro Piva, Member of the Italian Team at the International Olimpiad in Informatics 2004
Email: alex.ander@infinito.it
Post Reply

Return to “Algorithms”