delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/06/04/04:44:26

From: pavenis AT lanet DOT lv
Message-ID: <B0000031621@stargate.astr.lu.lv>
To: djgpp AT delorie DOT com, "Aleksey Kondratyev" <akondra AT mv DOT ru>
Date: Thu, 4 Jun 1998 11:35:50 +0300
MIME-Version: 1.0
Subject: Re: DJGPP 2.8.0 labels as values problem
In-reply-to: <6l5h74$jio$1@simtel.ru>

From:           	"Aleksey Kondratyev" <akondra AT no-spam-mv DOT ru>
Subject:        	DJGPP 2.8.0 labels as values problem
Date sent:      	Thu, 4 Jun 1998 11:05:12 +0400

> Hello DJGPP users,
> 
> I have a problem using labels as values gcc extension
> in a c++ module. The following sample was compiled
> fine by DJGPP 2.7.2.1but 2.8.0 version complains on
> "Error: sorry, not implemented: initializer contains
> unrecognized tree code".

Looks that it works with 2.7.2.1 but gives message You mentioned above
with 2.8.1. If such code is really needed then perhaps You should 
currently use 2.7.2.1. The second thing You should do is to send bug report 
about gcc (see info files how to do this)

> 
> #include <fstream.h>
> #define ADD 0
> #define SUB 1
> template<class T>
> T do_it(T a,T b,int op) {
>     static void *oops[]={&&op_add,&&op_sub};
>     goto *oops[(const int)op];
>     op_add:
>       return a+b;
>     op_sub:
>       return a-b;
> }
> int main() {
>   cout<<do_it(2,2,ADD)<<'\n'<<do_it(2,2,SUB);
>   return 0;
> }
> 
> It is compiled fine without 'templates' but avoiding
> of a template in my real module is quite difficult.
> Please, suggest something!
> E.g., is it be possible to declare labels in g++
> beforehand?
> 

- Raw text -


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