From: Endlisnis Newsgroups: comp.os.msdos.djgpp Subject: Re: How can I tell if it's a bug from DJGPP or GCC? Date: Mon, 28 Sep 1998 19:03:58 -0300 Organization: BrunNet Lines: 61 Message-ID: <361007CD.9A07A71D@unb.ca> References: <6u7smk$9t7$1 AT nnrp1 DOT dejanews DOT com> NNTP-Posting-Host: usr4fton18.brunnet.net Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk D DOT J DOT Eleveld AT anest DOT azg DOT nl wrote: > class singelton > { > private: > singelton() { }; > ~singelton() { }; > > public: > static singelton instance; > }; > > singelton singelton::instance; That variable is instanced globally, so the destruction has to happen globally. > #include > > enum index { zero = 0, > one, > two, > three, > four > }; > > index GetVariable() > { > return zero; > } > > /* This assignment seems to be being skipped */ > const index problem = GetVariable(); > > void Test(index event) > { > switch(event) > { > /* Error occurs here */ > case problem: > break; > default: > } > > } > bug2.cc:25: case label `problem' does not reduce to an integer constant The value of 'problem' cannot be evaluated at compile time. I does not look at your code to find out that the function is a simple assignment, because it might not. It might be an infinite loop, how long is the compiler supposed to try to figure out what the value will be? 4 seconds... 10 seconds... 100 seconds... The reason why this doesn't work, is because there is no way of 100% gaurenteeing the value of a function (it might pick a random value out of memory). -- (\/) Endlisnis (\/) s257m AT unb DOT ca Endlisnis AT GeoCities DOT com Endlisnis AT BrunNet DOT Net