[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: g++ usage of new generates a segmentation fault
From: |
Maurizio Loreti |
Subject: |
Re: g++ usage of new generates a segmentation fault |
Date: |
11 Jul 2006 11:53:51 +0200 |
User-agent: |
Gnus/5.09 (Gnus v5.9.0) Emacs/21.4 |
"christophelimbree@hotmail.com" <christophelimbree@hotmail.com> writes:
> I am currently rewriting a c program in c++. I work under LINUX 2.6
> (DEBIAN). Sometimes I get a segmentation fault when I use "new". Could
> it be because of the compiler "g++". There are still some c functions
> like printf or open. Could it be the cause of my problem?
as long as 1) all variables allocated with new are freed once and only
once with delete; 2) all varables allocated with new [] are freed once
and only once with delete []; 3) you don't shoot yourself in the foot
with copy-ctors or assignment operators that do not handle correctly
pointers allocated with new or new []; 4) there is nothing corrupting
the arena like you writing in the wrong address (array index out of
range etc.) --- the use of new should be safe and do not cause any
segmentation fault.
--
Maurizio Loreti http://www.pd.infn.it/~loreti/mlo.html
Dept. of Physics, Univ. of Padova, Italy ROT13: ybergv@cq.vasa.vg
- g++ usage of new generates a segmentation fault, address@hidden, 2006/07/11
- Re: g++ usage of new generates a segmentation fault,
Maurizio Loreti <=
- Re: g++ usage of new generates a segmentation fault, Christophe Limbrée, 2006/07/11
- Re: g++ usage of new generates a segmentation fault, Paul Pluzhnikov, 2006/07/12
- Re: g++ usage of new generates a segmentation fault, Christophe Limbrée, 2006/07/14
- Re: g++ usage of new generates a segmentation fault, Alan Woodland, 2006/07/14
- Re: g++ usage of new generates a segmentation fault, Paul Pluzhnikov, 2006/07/14
- Re: g++ usage of new generates a segmentation fault, Christophe Limbrée, 2006/07/19
Re: g++ usage of new generates a segmentation fault, Paul Pluzhnikov, 2006/07/11