delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2001/05/25/18:30:16

From: "Vermin" <ratspl AT hotmail DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Help... classes and optimization problem
Lines: 43
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.00.2919.6600
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6600
Message-ID: <k1BP6.1409$vu4.130732@news3.oke.nextra.no>
NNTP-Posting-Host: 130.67.72.107
X-Complaints-To: news-abuse AT nextra DOT no
NNTP-Posting-Date: Sat, 26 May 2001 00:29:36 MEST
Organization: Nextra Public Access
X-Trace: news3.oke.nextra.no 990829776 130.67.72.107
Date: Sat, 26 May 2001 00:32:06 +0200
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Hi!
I'm currently making my first classes, but I seem to run into problems when
I'm turning on the optimization... I use the current code:

class someting{
    public:
        someting() { };
        someting(char string[256]);
        ~someting() { };

        bool HandleString(char string[256]);
    private:
}

something::something(char string[256]){
    HandleString(string);
}

bool something::HandleString(char string[256]){
    /*Something... anything*/
    return true;
}

---EOF---

OK...there might be somer errors there, but I hope you get the point... So
when I use the class in the following way, everything works fine:

something s;
s.HandleString("Angel!");

..but I get a "general protection fault" error when I use the following
code:

something s("Angel!");

..and this is only when optimization is turned on (-O2 or -O3). What might
be wrong? Any suggestions?

Thanks!
  Vermin


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019