help-gplusplus
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: I get a segmentation fault if I dont use printf


From: Paul Pluzhnikov
Subject: Re: I get a segmentation fault if I dont use printf
Date: Tue, 06 Jun 2006 17:01:51 -0700
User-agent: Gnus/5.1006 (Gnus v5.10.6) XEmacs/21.4 (Jumbo Shrimp, linux)

aamircheema@gmail.com writes:

> I have written a program (my first big program in c++). When I run the
> program it gives segmentation fault but when i use a printf statement
> to debug the program, it runs normally.

Lesson 1: don't use printf() to debug programs.

> I am very confused that what may be the reason?

The reason is that adding printf()s changes the program layout in
memory, and may hide (or expose) bugs.

> Any Ideas?

Learn and use 'gdb'.

Cheers,
-- 
In order to understand recursion you must first understand recursion.
Remove /-nsp/ for email.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]