Colobot Forum - International Colobot Community
crash when trying to compile a static object - Printable Version

+- Colobot Forum - International Colobot Community (https://colobot.info/forum)
+-- Forum: [Archive] New forum (2015-2019) (https://colobot.info/forum/forumdisplay.php?fid=76)
+--- Forum: Colobot: Gold Edition Basics (https://colobot.info/forum/forumdisplay.php?fid=58)
+---- Forum: General (https://colobot.info/forum/forumdisplay.php?fid=59)
+---- Thread: crash when trying to compile a static object (/showthread.php?tid=873)



crash when trying to compile a static object - nknk - 12-23-2016

Hi, I found a crash "seg fault"

I report it here before creating one more issue as I don't want to be annoying Big Grin

when you try to use and initialize an object as static, it will crash at compile

Code:
public void extern object::test(){
  bug me();
}


class myClass{void myClass(){}}

class bug{
  static myClass omy=new myClass();
  void bug(){}
}

the only way I found to initialize omy (only 1 times) was to pass a fresh object to the constructor :

Code:
public void extern object::test(){
  myClass again();
  bug me(again);
}

class myClass{void myClass(){}}

class bug{
  static myClass omy;

  void bug(){}
  void bug(myClass omy){
    this.omy=omy
  }
}