Mailinglist Archive: opensuse-programming (55 mails)

< Previous Next >
Curious C++ segmentation fault
  • From: John Lamb <J.D.Lamb@xxxxxxxxxxxxxx>
  • Date: Sun, 14 Sep 2003 20:40:04 +0100
  • Message-id: <3F64C414.9010905@xxxxxxxxxxxxxx>
Can anyone suggest for me reasons why the first of these two fragments might produce a segmentation fault while the second works fine?

ssc::RunSet has only one constructor, which takes no parameters.

++

#include"Executive.h"

void ssc::Executive( int argc, const char* args[] ){
...
ssc::RunSet runset; /* FAILS HERE */
runset.run();
}

++

#include"Executive.h"

void ssc::Executive( int argc, const char* args[] ){
...
ssc::RunSet* runset = new ssc::RunSet();
runset->run();
delete runset;
}

++

--
JDL

Non enim propter gloriam, diuicias aut honores pugnamus set propter
libertatem solummodo quam Nemo bonus nisi simul cum vita amittit.


< Previous Next >
Follow Ups